What If a JSON Message Contains the Same Field Twice?

A message contains two values for the same status field: one says pending and the other says approved. The receiving tool shows only approved. Another tool rejects the message. A third preserves both. Which interpretation should the workflow trust?
This is an input ambiguity, not a business approval. A reliable integration should establish a duplicate-field policy before the data reaches an action that depends on the field.
Understand why the ambiguity matters
RFC 8259's object guidance says object member names should be unique and describes differing implementation behavior when they are not. Some parsers retain the last value, some fail, and some expose duplicates.
Once an ordinary parser has discarded one occurrence, later validation may see only a normal-looking object. A schema check performed at that point may be unable to reveal that the original message was ambiguous.
The practical control belongs at a boundary where duplicate occurrences are still observable.
Define the policy before processing
For business messages, a straightforward policy is to reject duplicate property names within the same object and return a specific error to the producer. Document the scope of that policy.
The same property name appearing in two different nested objects is not inherently a duplicate within one object. A customer object and a supplier object may each legitimately have a name field. Tests must distinguish that valid structure from repeated names in a single object.
Avoid accepting duplicates only when their values happen to match. That creates a second interpretation rule and can conceal a producer defect that later emits conflicting values.
Trace where detection is possible
Identify the first component that receives the raw JSON and the parser it uses. Verify whether it can detect repeated names before converting the message into an ordinary map or dictionary.
If an intermediary parses and reserializes the data first, the original duplication may already be lost. Document that limitation and move the control upstream where feasible. Do not claim to detect a condition that the available representation cannot retain.
Keep diagnostic evidence minimal. A field path, message identifier and error classification may be enough; storing entire customer payloads merely to investigate duplicates can expose unnecessary information.
Use an illustrative approval example
A fictional integration receives an approval object with two decision fields. The first value is pending and the second is approved. Under the agreed policy, the message is rejected before any task advances.
The error identifies the repeated property within the approval object. The producer fixes its construction logic and sends a new, unambiguous message with a new delivery record linked to the original failure.
The receiving team does not choose the more permissive value, the last value or the value that matches its expectations. None of those choices establishes which decision the authorized source intended.
Build a focused test set
Test conflicting duplicate values, identical duplicate values and duplicates inside a nested object. Also test valid repeated field names in different objects and arrays containing several objects with the same schema.
Include escaped spellings where the parser resolves the same property name from different textual representations. Use the actual parser's documented behavior and test facilities rather than a simple search for repeated character sequences.
A text search can flag normal occurrences in strings or miss names represented through escapes. The detection method must understand the JSON structure.
Separate syntax acceptance from business validation
After a message passes the duplicate-name policy, it still needs type, value and business-rule validation. A unique status field containing approved does not prove that approval was authorized.
The structured-output validation guide covers the next layer: whether the values make sense for the workflow. Duplicate detection addresses an earlier question about whether the message has a stable interpretation.
Keep these failure categories separate in operations. A producer that emits ambiguous structure needs a construction fix; a structurally valid but unauthorized action needs a different response.
Close the issue at the source
Record the producing component and the test that now prevents recurrence. Confirm that normal messages still pass and that an ambiguous message cannot trigger downstream side effects.
A successful fix is not simply that today's payload parsed. It is that the workflow has one documented interpretation policy, detects the ambiguous cases it claims to detect, and gives the producer enough information to correct them.
Explore FutureOS
For the project's published context, read Getting started with FutureOS. Its introduction describes FutureOS as being in prelaunch. This guide presents general planning practices, not a claim that FutureOS currently provides the workflow described here.
Prepared with AI assistance. Sources checked on October 22, 2026. Examples identified as illustrative are not customer results; no independent editorial review is claimed.



Comments