Unexpected end of JSON input

Why 'Unexpected end of JSON input' happens and how to fix it. The document stops before it is finished, usually a missing closing brace or a truncated response.

Open the JSON formatter

What the error looks like

Different engines word this differently. You may see any of these:

Why it happens

Example

Invalid
{
  "name": "My Mosaic",
  "tags": ["android", "puzzle"
Valid
{
  "name": "My Mosaic",
  "tags": ["android", "puzzle"]
}

How this tool reports it

The formatter points at the bracket that was left open rather than at the end of the file, and offers to close the open structures for you.

Paste your JSON into the formatter to see the exact line and column, or use the validator if you only need to check it.

Worth knowing