SQLiteのJSON5

JSON5

[16] JSON5 は、 JSON と似て非なるデータ形式です。 その名前に反して、 JSON とは無関係に作られたものです。

JSON5

[6] JSON5 は、 JSONES5 を参考に開発されたデータ形式です。 JSON と称していますが JSON ではありません

[17] 開発主体も JSON とも ECMAScript とも無関係です。 勝手JSON を称しているだけで新バージョンでもないので要注意。

[5] The JSON5 Data Interchange Format, , https://spec.json5.org/

[1] aseemk/json5 ( ( 版)) https://github.com/aseemk/json5

[2] JSON5 by aseemk ( ( 版)) http://json5.org/

[3] JSON5 by aseemk ( 版) http://json5.org/

JSON5 is a proposed extension to JSON that aims to make it easier for humans to write and maintain by hand. It does this by adding some minimal syntax features directly from ECMAScript 5.

JSON5 remains a strict subset of JavaScript, adds no new data types, and works with all existing JSON content.

JSON5 is not an official successor to JSON, and JSON5 content may not work with existing JSON parsers. For this reason, JSON5 files use a new .json5 extension. (TODO: new MIME type needed too.)

[4] GitHub - json5/json5: JSON5 — JSON for humans, https://github.com/json5/json5

[7] GitHub - json5/json5-spec: The JSON5 Data Interchange Format, https://github.com/json5/json5-spec

[8] Web5とは無関係。

JSON6

[9] GitHub - d3x0r/JSON6: JSON for Humans (ES6), https://github.com/d3x0r/JSON6

ESON

[10] GitHub - mmkal/eson: ESON — JSON for humans, https://github.com/mmkal/eson

This is a backwards-compatible fork of https://github.com/json5/json5, with added support for template literals - based on the idea in this comment. Since JSON5 is a well-established and active project, most references to "JSON5" in this fork have not been replaced with "ESON", to avoid merge conflicts. When reading these docs and source code, you can mentally replace "JSON5" with "ESON" (or "json5" with "eson").

SQLite 版 JSON5

[12] JSON Functions And Operators, , https://www.sqlite.org/json1.html#json5

Beginning in version 3.42.0 (2023-05-16), these routines will read and interpret input JSON text that includes JSON5 extensions. However, JSON text generated by these routines will always be strictly conforming to the canonical definition of JSON.

For backwards compatibility, the json_valid(X) function continues to report false for inputs that are not canonical JSON, even if the input is JSON5 that the function is able to understand.

SQLite extends the JSON5 syntax in these two ways:

  1. Strict JSON5 requires that unquoted object keys must be ECMAScript 5.1 IdentifierNames. But large unicode tables and lots of code is required in order to determine whether or not a key is an ECMAScript 5.1 IdentifierName. For this reason, SQLite allows object keys to include any unicode characters greater than U+007f that are not whitespace characters. This relaxed definition of "identifier" greatly simplifies the implementation and allows the JSON parser to be smaller and run faster.
  2. JSON5 allows floating-point infinities to be expressed as "Infinity", "-Infinity", or "+Infinity" in exactly that case - the initial "I" is capitalized and all other characters are lower case. SQLite also allows the abbreviation "Inf" to be used in place of "Infinity" and it allows both keywords to appear in any combination of upper and lower case letters. Similarly, JSON5 allows "NaN" for not-a-number. SQLite extends this to also allow "QNaN" and "SNaN" in any combination of upper and lower case letters. Note that SQLite interprets NaN, QNaN, and SNaN as just an alternative spellings for "null". This extension has been added because (we are told) there exists a lot of JSON in the wild that includes these non-standard representations for infinity and not-a-number.

[13]JSON」と称して JSON5 に対応する邪悪。これは本来の JSON 仕様に違反している。 json_valid がまともな挙動なのは最後の良心か。

[14] しかも「JSON」を称した「JSON5」がオリジナルの JSON5 ではなく独自拡張付きとかいう地獄。

[15] なぜ「違うものには違う名前をつける」という簡単なことができないのか。

メモ

[11] 普及する前から fork が乱立とかやべーなwww しかも fork が面倒だから(意訳)と本家の名前を名乗ってるとか闇すぎるwww