SmartJson.io
← All JSON error messages

Unexpected end of JSON input: an empty or cut-off body

By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test

The parser ran out of text before the JSON was complete. Either there was no text at all (an empty response body), or the text stops part-way through, like a download cut off in the middle.

What each runtime prints

We ran these inputs through JSON.parse in each browser and Node version, and through json.loads in Python. These are the messages exactly as printed.

Input: An empty body
(empty string)
RuntimeExact message
Chrome 151Node 24Node 22Node 20Node 18Unexpected end of JSON input
Firefox 153JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Unexpected EOF
Python 3.13Python 3.12Python 3.10JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Input: JSON cut off in the middle
{"items": [1, 2
RuntimeExact message
Chrome 151Node 24Node 22Expected ',' or ']' after array element in JSON at position 15 (line 1 column 16)
Firefox 153JSON.parse: end of data when ',' or ']' was expected at line 1 column 16 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Expected ']'
Node 20Expected ',' or ']' after array element in JSON at position 15
Node 18Unexpected end of JSON input
Python 3.13Python 3.12Python 3.10JSONDecodeError: Expecting ',' delimiter: line 1 column 16 (char 15)
  • Only an empty body gives "Unexpected end of JSON input" in Chrome and Node 20+. Cut-off JSON gets a more specific message there, such as "Expected ',' or ']' after array element", which points at the column where the text stops.
  • Node 18 says "Unexpected end of JSON input" for both, so on Node 18 you cannot tell an empty body from a cut-off one.
  • Python reports an empty body as "Expecting value: line 1 column 1 (char 0)", the same message it gives for an HTML page.

Edit it or paste your own. It runs in your browser; nothing is uploaded.

Open the full JSON Repair tool →

Common causes

  1. 1

    A 204 No Content or a HEAD request

    Many APIs answer DELETE and some PUT requests with 204 and no body. Calling res.json() on it throws.

  2. 2

    An error with no body

    A 401, 403 or 500 from some servers and gateways has no body at all. The code calls res.json() before checking res.ok.

  3. 3

    A response cut off by a timeout or a size limit

    A proxy timeout, a dropped connection, or a body size limit ends the response early. The JSON stops mid-value.

  4. 4

    A stream read too early

    Parsing the first chunk of a streamed response, or a file that another process is still writing.

  5. 5

    A database column or log line that was too short

    JSON saved into a VARCHAR(255) column, or a log system that cuts long lines, keeps only the start of the document.

How to fix it

Read the body as text first. An empty string is a normal answer for some requests; handle it before parsing.

JavaScript

const res = await fetch(url, { method: 'DELETE' });
if (!res.ok) throw new Error(`${res.status} from ${res.url}`);
const text = await res.text();
const data = text ? JSON.parse(text) : null; // 204 and empty bodies give null

Python

r = requests.delete(url, timeout=10)
r.raise_for_status()
data = r.json() if r.content else None  # 204 and empty bodies give None
  • If the text is not empty but stops early, compare its length with the Content-Length header. A shorter body means the connection or a proxy cut it off.
  • The JSON Repair tool can close cut-off JSON so you can read what arrived, but the last value may be incomplete. Fix the source rather than shipping repaired data.

Related

  • Unexpected token '<': your code got an HTML page, not JSON
  • Trailing comma in JSON: "Expected double-quoted property name"
  • JSON Repair
  • JSON Validator

How we tested: the messages above come from running each input through the real parsers (Chrome 151, Firefox 153, Safari 26 (WebKit), Node 24, Node 22, Node 20, Node 18, Bun, Python 3.13, Python 3.12, Python 3.10) on October 9, 2026. The script and inputs are listed on How we test.

Published October 9, 2026. Found a message that reads differently in your version? Tell us and we will add it.

All Tools & Converters

JSON Tools

  • JSON Hub
  • JSON Formatter
  • JSON Validator
  • JSON Repair
  • JSON Error Messages
  • JSON Viewer
  • JSON Minify
  • JSON Stringify
  • JSON Sorter
  • JSON Compare
  • JSON to CSV
  • JSON to XML
  • JSON to YAML

XML Tools

  • XML Hub
  • XML Formatter
  • XML Validator
  • XML Compare
  • SOAP Formatter
  • WSDL Formatter
  • XML to JSON
  • XML to CSV

CSV Tools

  • CSV Hub
  • CSV Formatter
  • CSV Validator
  • CSV to JSON
  • CSV to XML
  • Compare Tools

    • JSON Compare
    • XML Compare
    • YAML Compare
    • CSV Compare
    • Text Compare

YAML Tools

  • YAML Hub
  • YAML Formatter
  • YAML Validator
  • YAML to JSON
  • Other Tools

    • Converters Hub
SmartJson.io

JSON, XML, CSV and YAML tools that run in your browser. Nothing you paste is uploaded.

Sitemap

Company

  • About Us
  • Contact
  • How We Test
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 SmartJson.io. All rights reserved.

Report a problem with this page
Made withfor developers