I am trying to parse JSON from a server, however whenever I use AFNetworking the parser does not work, it returns the entire JSON rather than separating it.
I played around with the JSON and I noticed this .NET security feature
{"d":[JSON INSIDE]}
JSON INSIDE = My JSON Data that has 3 data objects, not shown here.
is causing the default JSON Parser to just return the entire JSON as 1.
If I remove the {“d”:}, it parses correctly into multiple parts. However, the return data from the server cannot have the d removed. Is there anywhere in AFNetworking that I can tell it to ignore the d part and only process the [JSON] inside the brackets?
Thanks,
Alan
Update: I am trying to reparse again after I get the data inside the “d:”, but I am getting a SigAbort on the NSJSonSerialization line.
NSString *innerData = [JSON objectForKey:@"d"];
NSLog(@"Inner Description %@", innerData);
NSError *jsonParsingError = nil;
NSDictionary *requestDictionary = [NSJSONSerialization JSONObjectWithData:[innerData dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&jsonParsingError];
Example JSON I am parsing:
{"d":[{"__type":"RequestSearchedInfo:#ChangeControlService.DataContracts","Description":"testing prod ","DueDate":"","Priority":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":2,"Name":"Medium"},"RequestId":368,"Requestor":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":5863,"Name":"A Person's Name"},"SentDate":"8\/31\/2012 4:28:11 PM","Status":{"__type":"StatusInfo:#ChangeControlService.DataContracts","Id":27,"IsEndState":false,"Name":"Pending Approval"},"System":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":11,"Name":"Internal-Testing"}},{"__type":"RequestSearchedInfo:#ChangeControlService.DataContracts","Description":"testing prod ","DueDate":"","Priority":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":2,"Name":"Medium"},"RequestId":367,"Requestor":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":5863,"Name":"A Persons Name"},"SentDate":"8\/31\/2012 4:27:40 PM","Status":{"__type":"StatusInfo:#ChangeControlService.DataContracts","Id":2,"IsEndState":false,"Name":"Pending Review"},"System":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":11,"Name":"Internal-Testing"}},{"__type":"RequestSearchedInfo:#ChangeControlService.DataContracts","Description":"testin","DueDate":"08\/03\/2012","Priority":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":3,"Name":"High"},"RequestId":29,"Requestor":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":5863,"Name":"A Persons Name"},"SentDate":"8\/2\/2012 1:58:34 PM","Status":{"__type":"StatusInfo:#ChangeControlService.DataContracts","Id":22,"IsEndState":false,"Name":"Acceptance Certification passed, Request to be Closed"},"System":{"__type":"ComponentInfo:#ChangeControlService.DataContracts","Id":11,"Name":"Internal-Testing"}}]}
Thanks!
I just figured it out… Thank you for all who responded.
Jeffery and Propstm
I just needed to do
Thanks!
Alan