{"id":"duplicate-key-audit","title":"Duplicate JSON object keys found in raw text, before a parser drops them","description":"Scans raw JSON text (RFC 8259) for repeated object member names at any depth, including inside arrays and keys spelled differently but equal after unescaping (\"a\" vs \"\\u0061\"), and reports each with its JSON pointer, UTF-8 byte offset, line, column and the value every occurrence carried, plus whether the values conflict. Also reports a leading BOM, unpaired surrogates, __proto__ keys and the exact syntax error offset. For agents that must inspect JSON before JSON.parse, json.loads or a gateway silently keeps the last duplicate. It does not validate against a schema and does not repair the text.","roi":"Parsers disagree on duplicate keys (last wins, first wins, error), so the same bytes can mean different things to two systems. 200 KB per $0.005 call.","audience":"developer","package":"data-contract-kit","channels":["x402","mcp"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/duplicate-key-audit","path":"/api/v1/duplicate-key-audit","contentType":"application/json"},"price":{"amount":"0.005","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","maxLength":200000,"description":"Raw JSON text, up to 200000 characters and 64 levels of nesting."}}},"resultSchema":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"validSyntax":{"type":"boolean","description":"True when the text is strict RFC 8259 JSON (a BOM makes the bytes non-conforming but is reported separately)."},"bom":{"type":"boolean"},"duplicateCount":{"type":"integer"},"duplicates":{"type":"array","items":{"type":"object","properties":{"objectPath":{"type":"string","description":"JSON pointer of the object holding the repeated key."},"key":{"type":"string"},"path":{"type":"string"},"count":{"type":"integer"},"conflictingValues":{"type":"boolean","description":"True when at least two occurrences carry different values; the key a last-wins parser keeps is the final occurrence."},"occurrences":{"type":"array","items":{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"spelling":{"type":"string","description":"The key exactly as written, with quotes and escapes."},"value":{"type":"string","description":"First 60 characters of the value as written."},"keptByLastWins":{"type":"boolean"}}}}}}},"hazards":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"path":{"type":"string"},"byteOffset":{"type":"integer"},"detail":{"type":"string"}}}},"syntaxError":{"anyOf":[{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"message":{"type":"string"}}},{"type":"null"}]},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"validSyntax":{"type":"boolean","description":"True when the text is strict RFC 8259 JSON (a BOM makes the bytes non-conforming but is reported separately)."},"bom":{"type":"boolean"},"duplicateCount":{"type":"integer"},"duplicates":{"type":"array","items":{"type":"object","properties":{"objectPath":{"type":"string","description":"JSON pointer of the object holding the repeated key."},"key":{"type":"string"},"path":{"type":"string"},"count":{"type":"integer"},"conflictingValues":{"type":"boolean","description":"True when at least two occurrences carry different values; the key a last-wins parser keeps is the final occurrence."},"occurrences":{"type":"array","items":{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"spelling":{"type":"string","description":"The key exactly as written, with quotes and escapes."},"value":{"type":"string","description":"First 60 characters of the value as written."},"keptByLastWins":{"type":"boolean"}}}}}}},"hazards":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"path":{"type":"string"},"byteOffset":{"type":"integer"},"detail":{"type":"string"}}}},"syntaxError":{"anyOf":[{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"message":{"type":"string"}}},{"type":"null"}]},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"text":"{\"id\": 1, \"items\": [{\"sku\": \"a\", \"sku\": \"b\"}], \"id\": 2}"},"openapiOperation":{"operationId":"duplicate_key_audit","summary":"Duplicate JSON object keys found in raw text, before a parser drops them","description":"Scans raw JSON text (RFC 8259) for repeated object member names at any depth, including inside arrays and keys spelled differently but equal after unescaping (\"a\" vs \"\\u0061\"), and reports each with its JSON pointer, UTF-8 byte offset, line, column and the value every occurrence carried, plus whether the values conflict. Also reports a leading BOM, unpaired surrogates, __proto__ keys and the exact syntax error offset. For agents that must inspect JSON before JSON.parse, json.loads or a gateway silently keeps the last duplicate. It does not validate against a schema and does not repair the text.\n\nPrice: 0.005 USDC on Base (x402).","x-x402-price-usdc":"0.005","x-x402-amount":"5000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.005"}},"x-audience":"developer","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/duplicate-key-audit","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","maxLength":200000,"description":"Raw JSON text, up to 200000 characters and 64 levels of nesting."}}},"example":{"text":"{\"id\": 1, \"items\": [{\"sku\": \"a\", \"sku\": \"b\"}], \"id\": 2}"}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"validSyntax":{"type":"boolean","description":"True when the text is strict RFC 8259 JSON (a BOM makes the bytes non-conforming but is reported separately)."},"bom":{"type":"boolean"},"duplicateCount":{"type":"integer"},"duplicates":{"type":"array","items":{"type":"object","properties":{"objectPath":{"type":"string","description":"JSON pointer of the object holding the repeated key."},"key":{"type":"string"},"path":{"type":"string"},"count":{"type":"integer"},"conflictingValues":{"type":"boolean","description":"True when at least two occurrences carry different values; the key a last-wins parser keeps is the final occurrence."},"occurrences":{"type":"array","items":{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"spelling":{"type":"string","description":"The key exactly as written, with quotes and escapes."},"value":{"type":"string","description":"First 60 characters of the value as written."},"keptByLastWins":{"type":"boolean"}}}}}}},"hazards":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"path":{"type":"string"},"byteOffset":{"type":"integer"},"detail":{"type":"string"}}}},"syntaxError":{"anyOf":[{"type":"object","properties":{"byteOffset":{"type":"integer"},"line":{"type":"integer"},"column":{"type":"integer"},"message":{"type":"string"}}},{"type":"null"}]},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/duplicate-key-audit/","docsJson":"https://agents.writerslogic.com/docs/duplicate-key-audit.json","sample":"https://agents.writerslogic.com/api/v1/samples/duplicate-key-audit","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}