When I try to Parse a JSON object,
let json = try? JSONSerialization.jsonObject(with: reportData, options: []) as? [String : Any]
I get an error saying that
Cannot invoke 'jsonObject' with an argument list of type 'with:([String:Any]), options:[Any]'
Here is my reportData in JSON format, obtained from Server
{
"status": "success",
"statusCode": 200,
"message": "Report exists",
"patientReport": {
"caseId": "case040784",
"Observations": "These are test observations",
"userUid": "MY5FDbl0bgZStAY5Ky6OtYAzbDT2",
"nextSteps": "Here are my next steps",
"customerUid": "customerUid",
"results": {
"test1": "12",
"test3": "15",
"test3": "12"
}
}
}
Could someone please guide me where I am going wrong.
jsonDatais already a Swift Dictionary of type[String: Any]. You have no need to parse it. Just use it as a Swift Dictionary.