SmartJson.io
← All JSON error messages

Extra data: two JSON documents where one was expected

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

The parser read one complete JSON value and then found more text after it. JSON.parse and json.loads accept exactly one value. The usual reason is a JSON Lines file (also called NDJSON), where each line is its own document.

What each runtime prints

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

Input: Two JSON objects, one per line
{"a": 1}
{"b": 2}
RuntimeExact message
Chrome 151Node 24Node 22Unexpected non-whitespace character after JSON at position 9 (line 2 column 1)
Firefox 153JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Unable to parse JSON string
Node 20Unexpected non-whitespace character after JSON at position 9
Node 18Unexpected token { in JSON at position 9
Python 3.13Python 3.12Python 3.10JSONDecodeError: Extra data: line 2 column 1 (char 9)
  • Chrome, Node 20+, Firefox and Python all point at line 2, column 1: the start of the second document.
  • Safari says only "Unable to parse JSON string", with no position.
  • Node 18 says "Unexpected token { in JSON at position 9". The { is the start of the second object.

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 JSON Lines file

    Log files, event exports, and batch files for many AI and data APIs use one JSON object per line, often with the extension .jsonl or .ndjson.

  2. 2

    json.dump() called more than once on the same file

    Appending a new object to a file in a loop writes several documents side by side, not one list.

  3. 3

    Two responses or chunks joined together

    Reading a streaming response and concatenating the chunks, or a retry that appended a second body to the first.

How to fix it

If the data is JSON Lines, parse each line on its own.

JavaScript

const rows = text
  .split('\n')
  .filter((line) => line.trim())
  .map((line) => JSON.parse(line));

Python

import json

with open("events.jsonl", encoding="utf-8") as f:
    rows = [json.loads(line) for line in f if line.strip()]
  • If the documents are joined with no newline between them, Python can still split them: json.JSONDecoder().raw_decode(text, i) returns one value and the index where it ends, so you can loop until the end of the text.
  • If you write the file yourself and want one document, collect the objects in a list and call json.dump() once.

Related

  • Trailing comma in JSON: "Expected double-quoted property name"
  • Unexpected end of JSON input: an empty or cut-off body
  • JSON Repair
  • JSON Viewer

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