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




JSON5 is an extension to the popular JSON file format that aims to be easier to write and maintain by hand (e.g. for config files). It is not intended to be used for machine-to-machine communication. (Keep using JSON or other file formats for that. 🙂)

here is WHY: it is SLOW

JSON5#parse x 327 ops/sec ±6.58% (31 runs sampled)
JSON#parse x 5,940 ops/sec ±5.23% (76 runs sampled)
JSON5#stringify x 1,270 ops/sec ±1.38% (85 runs sampled)
JSON#stringify x 13,748 ops/sec ±2.06% (84 runs sampled)

Amazon "Buy with Prime" vs UPS, FedEx

 Amazon will extend Prime shipping benefits, and its own reach, to independent e-commerce sites - GeekWire

"Amazon’s Buy with Prime program will extend Prime checkout and shipping benefits to independent e-commerce sites. (Amazon Photo)

A new Amazon program will let Prime members buy items on non-Amazon e-commerce sites just as they would on Amazon.com, including streamlined checkout and free delivery of items as soon as the next day.

It’s part of a broader effort by Amazon to extend its shipping operations beyond its own digital walls, competing more directly with UPS and FedEx — a move that analysts have been anticipating since last year."





Amazon: $1.2T
UPS: $160B
FedEx: $55B