George Murphy
George Murphy

Reputation: 1107

JSON malformed how to correct

When I try and parse this json I get an error expecting number at http://jsoneditoronline.org/

[{"urltitle":"","urltypeid":"2,4,4,5,5","seriesname":"Census of State and Federal    Correctional 

Facilities","titleb":"Census of State and Federal Correctional Facilities, 1995","url":"\/content\/pub\/press

\/CSFCF95.PR,\/content\/pub\/pdf\/CSFC95EX.PDF,\/content\/pub\/pdf\/Csfcf95.pdf,\/content\/pub\/ascii

\/csfc95ex.txt,\/content\/pub\/ascii\/csfcf95.txt","releasedate":"1997-08-07 00:00:00.0","urltype":"Press Release 

","pubproductid":535,"title":"CENSUS OF STATE AND FEDERAL CORRECTIONAL FACILITIES, 1995","tagkeywords":""},

{"urltitle":"","urltypeid":"2,4,4,5,13","seriesname":"Indicators of School Crime and Safety","titleb":"Indicators 

of School Crime and Safety, 2000","url":"\/content\/pub\/press\/iscs00.pr,\/content\/pub\/pdf\/iscs00.pdf,

\/content\/pub\/pdf\/iscs00ex.pdf,\/content\/pub\/ascii\/iscs00.txt,\/content\/pub\/sheets

\/iscs00.zip","releasedate":"2000-10-26 00:00:00.0","urltype":"Press Release 

","pubproductid":992,"title":"INDICATORS OF SCHOOL CRIME AND SAFETY, 2000","tagkeywords":""}] 

Upvotes: 0

Views: 92

Answers (1)

Mike Christensen
Mike Christensen

Reputation: 91726

You have a new line in a string constant:

 "seriesname": "Census of State and Federal    Correctional 

Facilities",

Should be:

 "seriesname": "Census of State and Federal    Correctional\n\nFacilities",

There are also several more of the same exact error.

Really, whatever created this JSON need to properly escape the data, including translating any carriage returns or line feeds to the appropriate escape sequences.

Upvotes: 1

Related Questions