Expand description
Lossy JSON output — best-effort, for piping to jq and human eyes.
CBOR carries types JSON can’t represent losslessly (int variants beyond ±2^53, byte strings, tagged values). This writer makes a clean best-effort:
- Integers print as JSON numbers when they fit in i64; otherwise as decimal strings.
- Floats print as JSON numbers (NaN/Inf →
null, which is whatserde_jsondoes too). - Byte strings render as
"0x<hex>"— strings, not numbers, so they survive JSON-aware tools. - Tagged values render their inner value; the tag is dropped. Use
cbor-diagwhen the tag matters.