SANJIESAN WORLDJOURNAL / COLLECTIONS / SANJIESAN
SANJIESANTOOLS

SANJIESAN TOOLS / Structured data checks

Find duplicate JSON keys before a value is lost

A text export can repeat a key and give it two different values. A later parsed object may show only one, making the source look less ambiguous than it was. Check for this condition before relying on the parsed record, using a small local fixture and no real inventory, customer or order data.

Keep the raw sample available

Create a harmless object text that repeats a descriptive key with two visibly different sample values. RFC 8259 recommends unique object member names and describes inconsistent receiver behaviour for duplicates. Do not assume a parse error will always warn you, or that the last visible value is the intended one. Keep the raw text separate from any parsed output, because once a receiver has collapsed duplicate members, a later ordinary field check may no longer show the conflict.

State the intended rejection point

For an importer you control, define where the raw-input check should flag the repeated name and how the record enters review. Write an expected error with the relevant object path. Avoid resolving two conflicting values by guessing from a label such as current or final. If the upstream export is at fault, keep a minimal example for the provider without private data. The task is to preserve the ambiguity until somebody with the right context resolves it.

Verify the corrected source as a new input

After an agreed correction, inspect the raw record again and keep the reason for the chosen value. Re-run the relevant field checks on the corrected copy rather than patching only a rendered summary. A duplicate-key check does not verify prices, rights or factual truth; it protects one structural boundary. No parser experiment was executed for this article, and any future implementation should be checked with its actual parsing and validation stack.

Sources & further reading

LET’S MAKE WHAT COMES NEXT

Have a product, a resource or an idea?

For suppliers, creators and brands. Tell us what you have in mind and where you work.

Start a conversation ↗