Failing to parse JSON... is the encoding messed up?
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.
精彩评论