Unexpected End of JSON Input – Causes and Fixes

Local only

This error means parsing reached the end of the text before the JSON value was complete. Missing closing braces, brackets, quotes, truncated responses, and empty input are common causes.

Indent

66 chars · 5 lines

Two-way sync · Edit either side and the other updates automatically.

Invalid JSONExpected ',' or '}' after property value
Line 5Column 1Character 67Found end of input

JSON parser error

Why JSON ends before parsing finishes

Unexpected end of JSON input is raised when a parser still expects more JSON syntax but the source text has already ended. The checker above starts with an intentionally truncated object so you can see how the parser location and nearby context point to an incomplete structure. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Browser-local JSON processing
  • Route-specific malformed JSON example
  • Focused parser or repair guidance
  • Broken and corrected JSON example
  • Related JSON problem navigation

Steps

  1. Paste the failing JSON or compare it with the preloaded truncated example.
  2. Inspect the final line and the reported parser position for an open object, array, or string.
  3. Restore the missing source text or closing delimiter, then validate again.

Common causes of unexpected end errors

A missing closing brace or bracket is the simplest cause, but the same message can appear when a network response is truncated, a file write stops early, a string quote never closes, or code calls JSON.parse on an empty string.

The parser reports where it finally ran out of input, so the true mistake can be earlier in the document. Work backward through the nearest still-open string, array, or object.

  • Incomplete copy and paste operations.
  • Partially downloaded or truncated API responses.
  • Missing }, ], or closing quotation marks.

Fix the source rather than guessing missing data

If the payload came from an API or file, first confirm that the producer returned the complete body. Adding a closing brace can make syntax valid while still hiding lost data from a truncated response.

Unexpected end of JSON input example

The object and roles array are opened, but the source ends before the required closing delimiters are present.

Truncated JSON

{
  "user": {
    "name": "Ada",
    "roles": ["admin", "editor"]

Completed JSON

{
  "user": {
    "name": "Ada",
    "roles": ["admin", "editor"]
  }
}

Common questions

Frequently asked questions

Why does JSON.parse say Unexpected end of JSON input?

The parser reached the end of the supplied text while it was still waiting for more valid JSON syntax, such as a closing brace, bracket, quote, or value.

Can an empty response cause this error?

Yes. Parsing an empty string is a common runtime cause, especially when an API returns no body but application code still calls JSON.parse or response.json().

Should I always add a closing brace to fix it?

No. If the source was truncated, adding punctuation may hide missing data. Verify that the complete response or file was received before repairing syntax.

Debugging a specific JSON issue? Browse JSON troubleshooting.