</>
ValidateHTML

Duplicate Keys in JSON

The JSON specification does not explicitly forbid duplicate keys, but it strongly discourages them. When duplicate keys exist, most parsers silently keep only the last value and discard earlier ones. This leads to data loss that is extremely hard to debug.

Why It Matters

Data is silently lost without any error or warning. If you have two properties named 'email', only the last one is kept. This can cause security issues, configuration bugs, and data corruption that goes unnoticed for a long time.

Code Examples

Invalid JSON
{
  "name": "John",
  "email": "john@work.com",
  "age": 30,
  "email": "john@personal.com"
}
Valid JSON
{
  "name": "John",
  "workEmail": "john@work.com",
  "personalEmail": "john@personal.com",
  "age": 30
}

How to Fix

  • 1Search for duplicate key names in your JSON document.
  • 2Rename duplicate keys to be unique and descriptive.
  • 3If you need multiple values for a concept, use an array instead.
  • 4Use a JSON linter that warns about duplicate keys, since most parsers silently accept them.

Check Your JSON Now

Our JSON validator detects this error automatically and shows the exact line and column.

Open JSON Validator
Recommended

Hostinger Fast & Affordable Web Hosting

Deploy clean, validated JSON APIs on reliable hosting.

Get 80% Off Hosting →

Related JSON Errors

View all JSON errors