Skip to content

7. Unknown tags

A reader may receive a typed value whose tag it does not know, for example a client without BSON support receiving { "$oid": "..." }.

UNKNOWN_IGNORE_DEFAULT MUST

By default, an implementation MUST NOT fail when deserializing a typed value with an unknown tag, except as stated in UNKNOWN_NOT_JSON.

UNKNOWN_PRESERVE MUST

When an unknown tag is ignored, the implementation MUST preserve the tag and its serialized value, so that serializing the result again produces the same typed value.

UNKNOWN_RAW MUST

The serialized value of an unknown tag MUST be preserved as it is: keys inside it MUST NOT be unescaped and typed values inside it MUST NOT be interpreted.

UNKNOWN_NOT_JSON MUST

When deserializing, an unknown tag whose value contains NaN, Infinity or -Infinity, which JSON5 input allows and JSON cannot represent, MUST fail, because it could not be written back unchanged (UNKNOWN_PRESERVE). Other JSON5 numbers inside it, such as +1, .5, 0x10 and -0, keep their value and are written back in JSON syntax (1, 0.5, 16 and 0, see TYPE_NUMBER_ZERO_READ).

UNKNOWN_ERROR_MODE MAY

An implementation MAY offer a mode that fails when deserializing a typed value with an unknown tag.

Source: lingodata/ecson@fe27835 · spec/sections/07-unknown-tags.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.