JSON WalletPrivacy-first JSON & API workspace

Fix "Unexpected non-whitespace character after JSON"

JavaScript / Python · JSON error

← All tools

Unexpected non-whitespace character after JSON dataSyntaxError: Unexpected non-whitespace character after JSON at position NExtra data: line N column N (char N)

Opens the editor with a broken example loaded and repaired, entirely in your browser — nothing is uploaded.

What causes it

A JSON document must contain exactly one top-level value. This error (Python calls it Extra data) means the parser successfully read a complete value and then hit more content that should not be there. Common causes:

  • Concatenated objects{"a":1}{"b":2} with nothing joining them. Wrap them in an array and add a comma.
  • Newline-delimited JSON (NDJSON) — one object per line. That is a valid stream format, but you must parse it line by line, not all at once.
  • A stray character after the closing bracket — a duplicated brace, a trailing log line, or copy-paste leftovers.

How to fix it

  1. Look at the position/column — the extra content starts right after the first complete value.
  2. If you have multiple objects, wrap them in [ ] and separate them with commas.
  3. If it is NDJSON, split on newlines and JSON.parse() each line separately.
  4. Paste it into JSON Wallet to see exactly where the first value ends and the extra data begins.

Before and after

Broken:

{"a": 1}
{"b": 2}

Fixed:

[
  {"a": 1},
  {"b": 2}
]

Want to fix your own JSON instead of the example? Open the editor, paste it in, and click Repair — it runs entirely in your browser.

Frequently asked questions

What is NDJSON and why does it cause this?

Newline-delimited JSON puts one JSON object per line. It is a streaming format, so a single JSON.parse() call over the whole thing fails after the first line. Parse each line individually.

How do I combine multiple objects into one document?

Wrap them in an array and separate them with commas: [{"a":1}, {"b":2}]. Then it is a single valid JSON value.


Related JSON errors

For a full reference of JSON mistakes, read Common JSON errors and how to fix them.

Press K for commands