I am sending this json response from the server to request to my iOS 7 application.
{ "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 am using the following code to parse the above json into an NSDictionary object.
NSMutableDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
But I get this error on the above code.
Domain error = NSCocoaErrorDomain Code = 3840 "Operation could not be completed. (Cocoa error 3840.)" (JSON text did not start with an array or an object and a parameter that allows not creating fragments.) UserInfo = 0x8a8a700 {NSDebugDescription = JSON text did not start with array or object and the ability to allow fragments.}
ios iphone ios7
LvN Jan 30 '14 at 9:27 a.m. 2014-01-30 09:27
source share