我想解析 iOS SBJSON 框架中以下 url 产生的 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:""},
我在用http://www.bodurov.com/JsonFormatter/ http://www.bodurov.com/JsonFormatter/在线阅读。
在 ASIHttpRequest 响应方法中我删除了同时(1);从响应中
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
我猜想没有双引号的 JSON 键会导致问题。
代替 {"title":“医院 - 谷歌地图”,
“urlViewport”:假,
},我们得到{title:“医院 - 谷歌地图”,
“urlViewport”:假
}
请帮我解析这个从 Google 返回的复杂 JSON 结构。