{·}jsontools.me
JSON GUIDE

Duplicate JSON keys: valid-looking, ambiguous data

Why consumers disagree and how to find duplicates before they disappear.

5 minute read · Updated August 2026Detect duplicate keys

Many parsers keep only one value

When the same object key appears twice, common parsers choose the first value, the last value, or reject the document. Converting immediately to an ordinary map erases evidence that the duplicate existed.

Detection belongs in the parse pass

A source-aware visitor can track keys per object and report the exact JSON Pointer while the tokens are still available.

{ "role": "user", "role": "admin" }

Treat duplicates as an interoperability warning

Even if your chosen consumer has defined behavior, another service may not. Removing or renaming the duplicate makes the contract explicit.