JSON Array

can I create a json array without key? An example:

{

    [

        {

            "id":1,

            "name":"Otto Matic",

            "icon":"",

            "developer":"Pangea Software"

        },
        {

            "id":2,

            "name":"Minecraft",

            "icon":"",

            "developer":"Mojang"

        }

    ]

}

Accepted Reply

Nope, that’s not valid JSON. The top level is an object (starts with curly brace) so it needs to contain keys and values. But you can have an array as the top level in the JSON document, like this:

[
    {"id": 1, "name": "Otto Matic", "icon": "", "developer": "Pangea Software"},
    {"id": 2, "name": "Minecraft", "icon": "", "developer": "Mojang"}
]

Replies

Nope, that’s not valid JSON. The top level is an object (starts with curly brace) so it needs to contain keys and values. But you can have an array as the top level in the JSON document, like this:

[
    {"id": 1, "name": "Otto Matic", "icon": "", "developer": "Pangea Software"},
    {"id": 2, "name": "Minecraft", "icon": "", "developer": "Mojang"}
]