B
B
beduin012015-12-02 15:15:28
JSON
beduin01, 2015-12-02 15:15:28

Why is this JSON not valid?

In one script I used JSON. It seemed to me that it was valid, but I began to run it through the validator and got an error.
Here is the JSON itself. What's wrong with it?

{
        "id": 1
        },

        {
        "id": 2
        },

        {
        "id": 3
        },
        {
        "id": 4
        }

Checked with this service jsonlint.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2015-12-02
@beduin01

JSON document can only contain 1 object
Wrap everything in square brackets - will be an array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question