Skip to main content

Module json

Module json 

Source
Expand description

JSON key interning — replace repeated keys with short references.

Forward: scan JSON, find key strings, replace with \x00 + index. Reverse: scan for \x00 markers, expand from key dictionary.

Escape scheme (null byte cannot appear in valid JSON): \x00 + idx (0..=252) → key dictionary reference \x00 + 0xFD + u16 LE → extended key reference (253..65535) \x00 + 0xFE → literal null byte (escape)

Functions§

preprocess
Forward transform: intern repeated JSON keys.
reverse
Reverse transform: expand key references back to original strings.