A custom Contact Form 7 connector sends a JSON object containing the same field name twice. One value says the inquiry belongs to sales; the other says support. After ordinary decoding, a validator may see only one of them. The receiver needs a policy for repeated object names before it maps the record into a CRM.

This guide addresses the raw JSON boundary of an adapter you maintain. It is separate from duplicate names in form controls and from repeated delivery of an entire inquiry. It does not assume that all CF7 connectors emit JSON, or that core CF7 supplies the receiver shown here.
Recognize the ambiguity before choosing a value
Consider the synthetic text {"department":"sales","department":"support"}. There is one object with two members bearing the same name. Compare that with an intentional array, such as {"services":["sales","support"]}. Multiple array items can be a valid contract; competing values for one object member require another decision.
RFC 8259’s object section recommends unique member names and describes differing receiver behavior when names repeat. Do not describe every duplicate-containing document as universally rejected by JSON syntax. Define your own receiver’s stricter interoperability rule and publish it with the payload contract.
The I-JSON profile forbids duplicate object names and compares names after escape processing. Thus an escaped spelling and a literal spelling can represent the same member name. Detect decoded names, not just repeated character sequences in a text search.
Detect duplicates during decoding
Python’s json reference documents object_pairs_hook, which receives the ordered name-value pairs of each decoded object. A small hook can reject a repeated name while constructing the dictionary. The following teaching example also rejects nonstandard numeric constants; it is not a complete HTTP receiver.
import json
def unique_object(pairs):
result = {}
for key, value in pairs:
if key in result:
raise ValueError("Repeated JSON object member")
result[key] = value
return result
def reject_constant(value):
raise ValueError("Nonstandard JSON numeric constant")
payload = json.loads(
raw_text,
object_pairs_hook=unique_object,
parse_constant=reject_constant,
)
if not isinstance(payload, dict):
raise ValueError("Expected a top-level object")
Run this at the first JSON decoding boundary you control. If a framework has already converted the body to a dictionary, the missing duplicate evidence cannot reliably be reconstructed. Configure that framework’s documented parser hook or retain the bounded raw request body until your chosen decoder has applied the policy.
The hook applies to nested objects as well. Two separate objects may each contain a department member without conflict. A single nested object containing that name twice should fail. Avoid one global set of names across the whole document, which would incorrectly reject ordinary repeated structures.
Do not trim, lowercase or otherwise normalize member names inside this duplicate detector unless the contract explicitly defines that additional rule. Exact decoded-name equality is the narrow check shown here. Destination-specific case folding belongs in a later mapping step, where collisions can be reported with their own explanation.
Do not repair ambiguity after parsing
The ECMAScript JSON.parse specification defines how earlier values for duplicate names are overwritten. A reviver does not provide the original ordered member-pair stream. Adding a reviver after parsing is therefore not equivalent to rejecting repeated names while decoding the source.
The JSON.parse reference is useful for understanding the reviver’s role and traversal. In a JavaScript receiver, select a maintained parser or documented framework feature that explicitly supports your duplicate-name policy. Do not try to turn a regular expression into a JSON parser: escapes, nesting and string contents make that shortcut unreliable.
Schema validation remains necessary after decoding. It can check required members, types, allowed values and unknown properties. It cannot compare a discarded first value with a surviving last value. Use the payload validation comparison for that later stage, after the raw representation passes.
Return a useful failure without creating a lead
Apply the duplicate check before destination writes. Catch decoding and policy errors at the receiver boundary and return the documented client-error response. A Python exception left uncaught can become a misleading server failure. Record a correlation ID and error category without copying personal inquiry text into a broad diagnostic log.
Treat an unchanged malformed payload as an input problem rather than a transient outage. Repeatedly resending the same bytes will not resolve two competing department values. Preserve the delivery receipt, tell the integration owner which contract rule failed and replay only after a reviewed correction. Existing retry handling still applies to genuine temporary failures.
Verify the narrow rule separately
Use synthetic fixtures for a valid object, equal duplicate values, conflicting duplicates, nested duplicates, escaped equivalent names and arrays of separate objects. Also include malformed JSON and a top-level array if the contract requires an object. Keep request-size, nesting, authentication and authorization limits at their own boundaries; this hook alone does not provide them.
The practical outcome is one unambiguous mapping per accepted object. For separate form activity statistics, review Svetlik Analytics for Contact Form 7. A statistics plugin and a receiver’s parsing policy answer different operational questions, and neither establishes final inbox delivery.
