Xcode 12.2, Simulator crashing during parsing JSON file into array

Hi all. I have an error as Xcode isn’t letting me parse my JSON file data into an array. It says in the diagnostic report that “Fatal error: Couldn’t parse Rest.json as Array:
dataCorrupted(Swift.DecodingError.Context(codingPath: , debugDescription: “The given data was not valid JSON.”, underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 “No string key for value in object around character 3.” UserInfo={NSDebugDescription=No string key for value in object around character 3.}))): file SaiMirrasKitchen/ModelData.swift, line 30”

So if anyone could help, I would appreciate it!

  • Harri

So what’s your JSON look like? And your parsing code? Kinda hard to say what’s wrong unless we see that.

This has the JSON File and the Parsing Code.

Your JSON file is invalid. There is a missing comma in the record with the id of 1014

"id":1014,
     "name":"Egg Kurma"
     "imageName":"eggkurma",
     "description":"Slit eggs boiled and mixed with gravy. Made up of spices and coconut. Great for both rice and chapathi.",
     "category":"Curries"

should be:

"id":1014,
     "name":"Egg Kurma",
     "imageName":"eggkurma",
     "description":"Slit eggs boiled and mixed with gravy. Made up of spices and coconut. Great for both rice and chapathi.",
     "category":"Curries"