Do JSON keys need to be unique? [duplicate]

There is no “error” if you use more than one key with the same name, but in JSON, the last key with the same name is the one that is going to be used.

In your case, the key “name” would be better to contain an array as it’s value, instead of having a number of keys “name”. It doesn’t make much sense the same object or “thing” to have two names, or two of the same properties that are in conflict.

E.g.:

{
  "name" : [ "JOHN", "JACK", "...", ... ]
}

Leave a Comment