iOS の SBJSON フレームワークhttp://maps.google.com/maps?q=school&mrt=yp&sll=13.006389,80.2575&output=jsonの次の 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/を使用してオンラインで読んでいます。
ASIHttpRequest 応答メソッドで、while(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": "hospital - Google Maps", "urlViewport": false, } の代わりに { title : "hospital - Google Maps", "urlViewport": false } を取得します
Google から返されたこの複雑な JSON 構造を解析するのを手伝ってください。