JSON superset — ES2019 is coming…

Sérgio Vinícius de Sá Lucena
1 min readJun 3, 2019

In my last post, I mentioned how JavaScript is evolving fast and listed all the features that will be standardized in the language in the next release this year.

Today I want to talk about JSON superset, so just to keep track of what I've talked so far, here goes the list of the ES2019 (or ES10) features:

JSON Superset

We all know JSON as a lightweight format for data interchange. It's widely used as it's very simple to read and parse, besides also supporting types, objects, and arrays.

Basically, JSON was intended to be a subset inJSON.parse (as ECMAScript claims) but that is not true because JSON strings can contain unescaped U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR characters while ECMAScript strings can't.

This proposal comes to solve this issue, so we don't need to use an escape sequence to put these 'special chars' into a string anymore.

Before that, the following code would throw an error:

ECMAScript string literals syntax error produced by the paragraph separator character before JSON superset implementation (in chrome 63)

Now, this issue will be gone!

Essentially, they extended the DoubleStringCharacter and SingleStringCharacter productions of ECMA-262 to allow unescaped U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR characters. That's it! Pretty simple, right?

--

--