1. Typed values
ECSON represents values that JSON cannot express natively (dates, big integers, sets, maps, binary data and others) as typed values: small JSON objects whose single key names the type.
1.1 Output format
Section titled “1.1 Output format”OUTPUT_JSON MUST
Every ECSON serialization MUST be a valid JSON text as defined in RFC 8259.
1.2 Definition
Section titled “1.2 Definition”TYPED_VALUE MUST
A JSON object with exactly one key, where that key starts with a single $ (and not with $$), MUST be interpreted as a typed value. The key is the tag and its value is the serialized form of the type.
Any other JSON object (with zero or more than one key, or whose single key does not start with a single $) MUST be interpreted as a plain object, never as a typed value.
1.3 Recursion
Section titled “1.3 Recursion”RECURSION MUST
Serialization and deserialization MUST be recursive: typed values MAY contain other typed values and plain objects, and the escape convention (section 2) MUST be applied to every plain object at any depth, including plain objects inside typed values.
1.4 Key order and canonical form
Section titled “1.4 Key order and canonical form”KEY_ORDER_PRESERVE MUST
When serializing a plain object, an implementation MUST emit its keys in the enumeration order of the source object in the host language.
CANONICAL_JCS MAY
An implementation MAY offer a canonical serialization mode. In canonical mode, the output MUST follow the JSON Canonicalization Scheme (JCS) defined in RFC 8785, applied after ECSON serialization, and MUST fail for strings, including object keys, with lone UTF-16 surrogates, which RFC 8785 does not allow.
Source: lingodata/ecson@fe27835 · spec/sections/01-typed-values.md · ecson 0.2.0 (draft)
LingoData specifications, reference implementations and this site are licensed under the Apache License 2.0. Copyright 2026 Gustavo Gondim.