JSON and data guides
JSON Unicode keys: escapes and normalization are different
Compare decoded key names while preserving distinctions between composed and decomposed Unicode text.
Escapes preserve the same character
A literal A and the escape for code point U+0041 decode to the same string. JSON formatting can change this representation without changing the name.
Use Unicode Escape to inspect unfamiliar characters, and compare parsed names when testing representation equivalence.
JSON.parse('{"\u0041":1}').A → 1Canonical equivalence is a separate rule
A composed accented character and a base character plus combining mark can look identical while remaining different JSON keys.
JSON parsing does not automatically normalize them. An object can legally contain both names if they are distinct decoded strings.
const x = JSON.parse('{"\u00e9":1,"e\u0301":2}');
Object.keys(x).length → 2Normalize only with a collision policy
Normalizing every name to NFC can collapse these two keys. Assignment into a new object may silently replace an earlier value.
If your protocol mandates normalization, detect collisions before constructing the normalized object and reject or resolve them explicitly.
Keep storage and display distinct
For externally defined field names, preserve the agreed bytes and decoded strings. Display similarity is not a safe identity rule.
Add fixtures containing escaped ASCII, combining marks and visually similar scripts; formatting and schema validation answer different questions here.