I am new to the iOS development , I have dictionary as given below, I want to convert it to JSON, pass it to API
["checkinDate": "",
"data": [{
"abc": 2,
"cde": 13,
"edt": 1,
"shortName": "OCC"
}],
"incidentDescription": "",
"store": "ABD"
]
Code:
let jsonData = try! JSONSerialization.data(withJSONObject: saveDict)
let jsonString = NSString(data: jsonData, encoding: String.Encoding.utf8.rawValue)
I have used below code but it is giving output as
"materialList": ["{\"abc\":2,\"cde\":13,\"edt\":1,\"shortName\":\"OCC\"}"],
"checkinDate": "",
"incidentDescription": "",
It is add \ while converting array of dictionary to JSON