JSON Validation Expecting 'EOF'

In my case, it was a semi-colon at the end of JSON object that was throwing this error on jsonlint:

Expecting 'EOF', '}', ',', ']', got 'undefined'

Removing that solved it.


You haven't shown enough of your JSON, but I'm guessing it looks like this:

[
    {"some": "object"},
    {"some": "object"}
],
[
    {"some": "object"},
    {"some": "object"}
]

...which is invalid. In JSON, there must be one top-level item (which in a complete JSON document must either an object or an array).

If you're combining two responses, you might make each of them the value of a property on a wrapper object, e.g.:

{
    "response1": [
        {"some": "object"},
        {"some": "object"}
    ],
    "response2": [
        {"some": "object"},
        {"some": "object"}
    ]
}

Tags:

Json