I want to analyze the json output resulting from the following URL in the SBJSON framework for iOS http://maps.google.com/maps?q=school&mrt=yp&sll=13.006389,80.2575&output=json
while(1);{title:"school - Google Maps",url:"/maps?q=school\x26mrt=yp\x26sll=13.006389,80.2575\x26ie=UTF8\x26hq=school\x26hnear=",urlViewport:false,ei:"RCu3T4eeMqSiiAe7k-yZDQ",form:{selected:"q",q:{q:"school",mrt:"yp",what:"school",near:""},d:{saddr:"",daddr:"",dfaddr:""},geocode:""},
I use http://www.bodurov.com/JsonFormatter/ to read it online.
In the ASIHttpRequest response method, I deleted while (1); from the answer
NSString *responseString = [[request resonseString]substringFromIndex:9]; //to remove while(1) SBJSONParser * parser = [[SBJSONParser alloc]init]; NSDictionary *jsonDict = (NSDictionary*)[parser objectFromString:responseString]; NSLog(@"%@",jsonDict) // prints null // [responseString JSONValue] also reports error
I think that a JSON key without double quotes is causing the problem.
Instead of { "name": "hospital - Google Maps", "urlViewport": false,}, we get { name: "hospital - Google Maps", "urlViewport": false}
Please help me parse this complex JSON structure returned from Google.