I encountered the same issue before, where jsonDecode()
was throwing a FormatException
because the string I passed wasn't valid json. After validating it using json Formatter & Validator, https://jsonformatter.curiousconcept.com/#, I realized the structure was malformed (missing quotes or braces). Once I corrected the format, the error was resolved.