开发者

Failing to parse JSON... is the encoding messed up?

开发者 https://www.devze.com 2023-01-08 02:03 出处:网络
I am trying to parse the JSON returned here: http://www.waterwayguide.com/map/php/bridge.php?ll=25.514339,-80.076164

I am trying to parse the JSON returned here: http://www.waterwayguide.com/map/php/bridge.php?ll=25.514339,-80.076164

However, I can't parse it as I normally would it seems:

NSData *jsonData = [[(ASIHTTPRequest*)[data objectForKey:@"request"] responseString] dataUsingEncoding:NSUTF32BigEndianStringEncoding]; 
NSLog(@"this prints as expected %@", [(ASIHTTPRequest*)[data objectForKey:@"request"] responseString]);
NSArray* jsonNodes = 开发者_如何学Python[[CJSONDeserializer deserializer] deserialize:jsonData error:&error];
NSLog(@"this is unexpectedly nil %@", jsonNodes);

I have used this precise code on a different JSON feed and it works nicely. Is there something I can do on the client side to parse this feed properlY?


That feed isn't JSON. Look at the source. It's text/html and it doesn't validate because it attempts to escape ' with \'. Altogether, it seems to be a quick attempt to manually output JSON instead of HTML.

0

精彩评论

暂无评论...
验证码 换一张
取 消