JSON Formatter & Validator

"Unexpected end of JSON input": causes and fixes

The JSON ended before every { and [ was closed. Common causes such as truncated or empty responses, and how to fix them.

Error messages you may see

Chrome · Edge · Node.jsSyntaxError: Expected ',' or '}' after property value in JSON at position 23 (line 1 column 24)
Older Chrome · Node.js 18 and earlierSyntaxError: Unexpected end of JSON input
Python json.loadsjson.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 24 (char 23)
This toolLine 1, Col 10: '{' is never closed (opened on line 1)

Why it happens

The parser reached the end of the text while an object or array was still open. Usually a closing } or ] is missing, the response was cut off, or the body was empty, for example a 204 response or a failed request.

Invalid

{"user": {"name": "Kim" 

How to fix

Check that every { and [ has a matching } or ]. If the JSON comes from an API, log the raw text first (await res.text()) to see whether it is empty or truncated before parsing it.

Fixed

{"user": {"name": "Kim"}}

Open this example in the JSON formatter →

Other common JSON errors