2 ms·
That said, in theory, shouldn't: JSON.parse("0o10") === 8? I get SyntaxError: Unexpected token o in JSON at position 1
by jchook 7y ago
That said, in theory, shouldn't:
JSON.parse("0o10") === 8?
I get SyntaxError: Unexpected token o in JSON at position 1
- ufedvjot13467 7y agoNo. Valid json is valid JavaScript. Valid JavaScript is not, necessarily, valid json.
- jchook 7y agoThanks, I misunderstood the proposal, which apparently applies mostly to "unescaped LINE SEPARATOR or PARAGRAPH SEPARATOR characters" within strings.
- deleted 7y ago[deleted]
- Jasper_ 7y agoJSON.parse("(function() { })") doesn't parse either, despite being valid JavaScript. Both constructs are specific to JavaScript, and do not exist in JSON. Hence, JSON is a subset of JavaScript.