3 ms·
Is there any legal JSON that's not legal JavaScript? If not, it's fair to say it's a subset.
by bsimpson 2y ago
Is there any legal JSON that's not legal JavaScript?
If not, it's fair to say it's a subset.
- tubthumper8 2y agoIt is a subset as of JavaScript edition ES2019, when JavaScript strings are now allowed to contain U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR. Prior to ES2019, that was the only known example of legal JSON that was not legal JavaScript
- fanf2 2y agoJavaScript used to forbid U+2028 line separator and U+2029 paragraph separator in string literals, but JavaScript now allows them for compatibility with JSON. The remaining wrinkle is different handling of "__proto__"