Unexpected token o in JSON at p

Today, using JS to convert a $. Parsejson string to a JSON object will report an unexpected syntax error – unexpected token o in JSON at position 1. I couldn’t find the reason. After the ferry, I saw a sentence: there are strict requirements for JSON to convert objects into strings and store them locally, such as symbols or illegal strings, which may affect the later JOSN.parse The analysis of…

Change {type ‘:’name’} to {type ‘,’name’} and solve the problem

That’s right, JSON is sensitive to single and double quotation marks of strings, which leads to the single quotation mark in the real {} that reported the error…

****Replace single quotation marks with double quotation marks
var_ nstr = _ adrdata.replace (/’/g, ‘”’);

Read More: