Error when parsing mixed quotes
santiagopuentep opened this issue · 1 comments
santiagopuentep commented
Stringifying an object or string that has content with multiple quotes throws an error when parsing back to object again.
const data = prompt("Type text with three double quotes"); // insert three quotes like this """
EJSON.stringify(EJSON(parse(data)));
Throws:
Uncaught SyntaxError: Unexpected string in JSON at position 2
at JSON.parse (<anonymous>)
at Object.EJSON.parse.item [as parse] (ejson.js:411)
at <anonymous>:1:23
The browser's own JSON.stringify and JSON.parse combination works just fine.
santiagopuentep commented
Closed, my mistake, the browser's JSON object throws the same error.