I'm sending this json response from server for a request to my IOS 7 app.
{
"root": {
"success": "1",
"message": "Successfully retrieved data.",
"data": {
"records": [
{
"receipt_key": "xxxxxxxx",
"receipt_id": "xxxxxxxx",
"store_name": "xxxxxx",
"amount": "xxxx",
"date_purchase": "xxxxxxxx",
"is_processed": "x",
"created_on": "xxxxxxxx",
"modified_on": "xxxxxxxx",
"modified_on_millis": "xxxxxxxx",
"user_folder": "xxxxxxxx",
"category_id": "xxxxxxxx",
"is_deleted": "x",
"currency_id": "xxxxxxxx"
}
]
}
}
}
I use the following code for parsing the above json to NSDictionary object.
NSMutableDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
But I'm getting this error on the above code.
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x8a8a700 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
NSJSONReadingAllowFragments
? JSON seems to valid one. – Maciej Oczko