Sunday, May 08, 2022

JSON5 Data Interchange Format: "JSON for humans"

JSON is simplified subset of JavaScript data syntax.
Adding a few more JS features to JSON would help usability.

The JSON5 Data Interchange Format (json5.org)

"The JSON5 Data Interchange Format (JSON5) is a superset of JSON that aims to alleviate some of the limitations of JSON by expanding its syntax to include some productions from ECMAScript 5.1.

Similar to JSON, JSON5 can represent four primitive types (strings, numbers, Booleans, and null) and two structured types (objects and arrays)."



example:
{
  // comments
  unquoted: 'and you can quote me on that',
  singleQuotes: 'I can use "double quotes" here',
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  positiveSign: +1,
  trailingComma: 'in objects', andIn: ['arrays',],
  "backwardsCompatible": "with JSON",
}

this may be one of most downloaded on NPM? Weekly Downloads: 55,801,906







there are also official "readonly" versions in DotNet (C#) and GoLang (go) JSON5 @github







Currently, this library is about 20x SLOWER than using Jackson.

Rust


ANTLR parser grammar for JSON5



No comments: