Levels
There are 3 levels of JSON, from strictest to loosest:
- I-JSON
- JSON (ECMA)
- JSON5
- I-JSON RFC 7493
- constrains encoding to be UTF-8
- constrains object members to be unique
- recommends big decimals encoded as string
- recommends binary data encoded as string using base64url
- JSON (ECMA, json.org)
- is a sequence of unicode code points.
- allows arbitrary length decimals
- prohibits non-numeric numbers (Infinity, NaN)
- does not require object member names to be unique.
- JSON5
“is a superset of JSON that … [expands] its syntax to include some productions from ECMAScript 5.1“
It appears to exclude ECMAScript Reserved Words from allowed object member names, but relaxes the syntax to allow:- single trailing commas in an object member list and array element list,
- single quoted strings,
- // comments, /* multi
line comments */, - numbers to have
- leading plus, minus or no sign,
- 0x hexadecimal integer,
- Infinity and NaN,
- leading and trailing decimal points,
in addition, YAML is a superset of JSON. ie JSON is a strict subset of YAML.
However, “YAML primarily relies on outline indentation for structure”.