JSON / duplicate key / parser policy

Separate JSON duplicate keys and parser differences

Find duplicate keys, then separate last-wins, first-wins, rejection and parser differences. User input is never parsed; use synthetic cases only.

Five review axes

A duplicate key is not always rejected. Parser policy can change which value remains, so record detection separately from the selected policy.

duplicate key ≠ parser policy / detect → decide → verify
AxisReview
detectLook for same-name keys in one object scope.
last-winsMake an overwrite-by-later-value assumption explicit.
first-winsCheck differences from implementations keeping the first value.
rejectCheck whether duplicate keys can be rejected.
nestedKeep parent and child object scopes separate.

Safe review order

  1. Record duplicate names in one synthetic object scope.
  2. Separate last, first and reject parser policies.
  3. Check whether another parser changes the result.
  4. Approve the review note before returning to real settings.

This page never parses user input or real data. Change real settings only through the existing process after note approval.

Six synthetic cases

caseresult
last-winsLast value wins
first-winsFirst value wins
reject-duplicateReject duplicate
parser-differenceParser difference
nested-duplicateNested scope
unsupported-user-jsonReject