1
votes

I am reworking an old php app that uses a json file instead of a database, and the json file has this structure. It passes Json linter, but I am not sure what it's called (or how best to work with it), and since I don't know what to call it I don't know how to look it up.

I also don't know why it needs the first "Joe" if it's always identical to the first key/value in each object.

It feels like it's missing square brackets before the second curly brackets (or in place of them), but since it does actually work, I am somewhat confused.

Can you identify this json structure?

{
"Joe": {
    "name": "Joe",
    "title": "Accountant"
    },
"Mike": {
    "name": "Mike",
    "title": "Designer"
    }
}
1
Still quite unclear what your asking... - 0stone0
@YourCommonSense it works in 'production' if I can call it that - Shawn Taylor
This is not valid JSON. - trincot
Yes @ShawnTaylor, structure's like that are called invalid JSON. - 0stone0

1 Answers

1
votes

It's an object containing nested objects.

The duplication of the names allows looking up an object by name without having to search for it. Keeping the redundant copy in the nested object allows it to be self-identifying when it's extracted from the top-level object.