Skip to content

dataValueToJson

dataValueToJson(value): JsonValue

Defined in: packages/format-cbor/src/json-bridge.ts:20

Converts a DataValue to a JsonValue, following the non-normative advice in RFC 8949 §6.1.

Only the blanket “ignore the tag number, convert the tag content” rule is implemented for tags — the special-cased conversions for specific tags (bignums via tags 2/3, the base64/base64url/base16 encoding hints via tags 21-23) are not. simple values and undefined, and non-finite float values, convert to the RFC’s suggested substitute value, null.

DataValue

JsonValue

If a map has a non-text-string key — JSON object keys must be strings, and silently stringifying a non-text key risks a collision the RFC itself calls out as a danger.