JSON5 is an extension of JSON that adds human-friendly syntax features including comments, trailing commas, unquoted keys, and multi-line strings. It maintains full compatibility with standard JSON while being easier to read and write by hand.
Stencila supports JSON5 as a more human-readable, lossless alternative to JSON for storing documents. JSON5 is also used internally within Stencila as a concise, JavaScript-like way to represent node properties within Markdown-based formats.
Use the .json5 file extension, or the --to json5 or --from json5 options, when converting to/from JSON5 e.g.
stencila convert doc.smd doc.json5
By default, the encoded JSON5 is indented. The --compact option can be used to produce un-indented, single line JSON5.
Stencila supports lossless, bi-directional conversion between Stencila documents and JSON5. The codec-json5-trait Rust crate implements from_json5 and to_json5 methods for all node types in Stencila Schema, powered by json5 and json5format.