I am trying to parse the json output from
http://www.nyc.gov/portal/apps/311_contentapi/services/all.json
And my php json_decode returns a NULL
I am not sure where the issue is, I tried running a small subset of the data through JSONLint and it validated the json.
Any Ideas?
The error is in this section:
See where it says “hot spots.” in an already quoted string. Those
"‘s should’ve been escaped. Since you don’t have access to edit the JSON perhaps you could do a search for"hot spots.""and replace it with\"hot spots.\""likestr_replace('"hot spots.""', '\\"hot spots.\\""\, $str);for as long as that’s in there. Of course that only helps if this is a one time thing. If the site continues to make errors in their JSON output you’ll have to come up with something more complex.