Skip to content

Commit de344f0

Browse files
docs(readme): explain ecmascript compatibility
1 parent c3a7524 commit de344f0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ like **MacOS** and **iOS**.
2525
Formally, the **[JSON5 Data Interchange Format](https://spec.json5.org/)** is a superset of JSON
2626
(so valid JSON files will always be valid JSON5 files)
2727
that expands its syntax to include some productions from [ECMAScript 5.1] (ES5).
28-
It's also a strict _subset_ of ES5, so valid JSON5 files will always be valid ES5.
28+
It's also a _subset_ of ES5, so valid JSON5 files will always be valid ES5.[*](#ecmascript-compatibility)
2929

3030
This JavaScript library is a reference implementation for JSON5 parsing and serialization,
3131
and is directly used in many of the popular projects mentioned above
@@ -239,7 +239,7 @@ please submit an issue to the official
239239
**[_specification_ repository](https://github.com/json5/json5-spec)**.
240240

241241
Note that we will never add any features that make JSON5 incompatible with ES5;
242-
that compatibility is a fundamental premise of JSON5.
242+
that compatibility is a fundamental premise of JSON5.[*](#ecmascript-compatibility)
243243

244244
To report bugs or request features regarding this **JavaScript implementation**
245245
of JSON5, please submit an issue to **_this_ repository**.
@@ -248,6 +248,14 @@ of JSON5, please submit an issue to **_this_ repository**.
248248
To report a security vulnerability, please follow the follow the guidelines
249249
described in our [security policy](./SECURITY.md).
250250

251+
## ECMAScript Compatibility
252+
While JSON5 aims to be fully compatible with ES5, there is one exception where
253+
both JSON and JSON5 are not. Both JSON and JSON5 allow unescaped line and
254+
paragraph separator characters (U+2028 and U+2029) in strings, however ES5 does
255+
not. A [proposal](https://github.com/tc39/proposal-json-superset) to allow these
256+
characters in strings was adopted into ES2019, making JSON and JSON5 fully
257+
compatible with ES2019.
258+
251259
## License
252260
MIT. See [LICENSE.md](./LICENSE.md) for details.
253261

0 commit comments

Comments
 (0)