JavaScript Object Notation (JSON) is a lightweight data interchange format defined by ECMA-404 and widely used for structured data storage and transmission. JSON's simplicity and broad language support make it a common choice for APIs, configuration files, and data exchange.
Stencila uses JSON as the default storage format for documents. Conversion is lossless — all Stencila Schema node types and properties are preserved through round-trips.
Use the .json file extension, or the --to json or --from json options, when converting to/from JSON e.g.
stencila convert doc.smd doc.json
By default, the encoded JSON is indented. The --compact option can be used to produce un-indented, single line JSON.
When the --standalone option is used (the default for encoding to files), two properties are added to the JSON encoding of root nodes to improve interoperability:
{
"$schema": "https://stencila.org/Article.schema.json",
"@context": "https://stencila.org/context.jsonld",
"type": "Article",
...
Stencila supports lossless, bi-directional conversion between Stencila documents and JSON powered by serde_json.