Unexpected Non-Whitespace Character After JSON – Fix Extra Data

Local only

This error means one complete JSON value ended successfully, but non-whitespace content followed it. Common causes are concatenated objects, JSONL input, or accidental suffix text.

Indent

16 chars · 1 line

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

Invalid JSONUnexpected content after the JSON value
Line 1Column 9Character 9Found “{”
{"id":1}{"id":2}

JSON top-level structure error

Why valid JSON can still have extra characters after it

A standard JSON document contains exactly one top-level value. Two valid objects placed back to back are not one valid document, even though each object parses correctly on its own. 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. Find the first complete top-level JSON value and inspect what follows its closing token.
  2. If the trailing content is accidental, remove it at the producer.
  3. If multiple records are intentional, use a JSON array or JSONL format instead of concatenating values.

Multiple root values are not standard JSON

The parser is allowed to ignore whitespace after the root value, but not another object, array, number, string, or arbitrary text. This often happens when records are appended without a container format.

  • Two objects concatenated without a comma or array wrapper.
  • JSONL records fed to a single-document JSON parser.
  • Debug text appended after an otherwise valid API response.

Choose the container format that matches the data

Use a JSON array when the complete collection is one document. Use JSONL when records are intentionally independent and line-delimited. Avoid inventing separators that the consumer does not expect.

Two top-level JSON objects example

The objects are individually valid but invalid when concatenated as one JSON document.

Invalid combined JSON

{"id":1}{"id":2}

Valid JSON array

[{"id":1},{"id":2}]

Common questions

Frequently asked questions

Can JSON contain two top-level objects?

Not in one standard JSON document. Wrap them in an array or use a record-oriented format such as JSONL.

Is whitespace allowed after JSON?

Yes. Whitespace may follow the root value, but another non-whitespace token makes the document invalid.

Does this error mean the first JSON object is broken?

Not necessarily. The first value may be completely valid; the error can be caused only by content that appears after it.

Debugging a specific JSON issue? Browse JSON troubleshooting.