JSON Formatter

FreePrivateInstant

Paste any JSON below. format it, validate syntax errors, or minify for production. Everything runs in your browser.

Input
Output
Ctrl+Enter Format  ·  Ctrl+Shift+M Minify

JSON Parse Error – Find and Fix It Online

A SyntaxError: JSON.parse or Unexpected token message means your JSON has a structural mistake. Paste it above — the validator shows the exact line and column so you can fix it in seconds, not minutes of staring at raw text.

What the Error Messages Mean

Unexpected token X at line N
The parser hit a character it did not expect. Most often a missing comma before line N, or an unquoted key. Go to line N and look one line above for the missing separator.
Unexpected end of JSON input
The string ended before all braces or brackets were closed. Count your { vs } and your [ vs ] — one pair is missing.
Expected property name or '}'
A key is not in double quotes, or there is a trailing comma after the last property. JSON keys must always be double-quoted strings.
JSON.parse is not a function
This is a JavaScript error, not a JSON syntax error — something overwrote JSON in your environment. Check for a variable named JSON shadowing the global.

Every Common Parse Error, Fixed

Missing comma between properties
{ "a": 1 "b": 2 }
→ Fix
{ "a": 1, "b": 2 }
Trailing comma after last item
{ "a": 1, "b": 2, }
→ Fix
{ "a": 1, "b": 2 }
Unquoted keys
{ name: "Alice", age: 30 }
→ Fix
{ "name": "Alice", "age": 30 }
Single-quoted strings
{ 'name': 'Alice' }
→ Fix
{ "name": "Alice" }
Comment inside JSON
{ "a": 1 // comment
}
→ Fix
{ "a": 1 }
Unclosed brace or bracket
{ "a": [1, 2, 3 }
→ Fix
{ "a": [1, 2, 3] }

How to Fix a JSON Parse Error Step by Step

  1. Paste the JSON into the editor above and click Format
  2. Read the error: it shows the exact line and column of the problem
  3. Match the error message to the examples above to understand the cause
  4. Apply the fix, then click Format again to confirm the JSON is now valid

Quick Rules to Prevent Parse Errors

  • All keys must be double-quoted strings: "key", not key or 'key'
  • All string values must use double quotes: "value", not 'value'
  • Separate every property and array item with a comma — but not after the last one
  • No comments: // and /* */ are not valid JSON syntax
  • No trailing commas: { "a": 1, } is invalid
  • No undefined, functions, or NaN — only string, number, boolean, null, object, array

Frequently Asked Questions

What causes a JSON parse error?

Parse errors are usually caused by invalid syntax such as missing commas, trailing commas, bad quotes, broken braces, comments, or malformed strings. Two frequent causes are covered on JSON Error Missing Comma and JSON Trailing Comma.

What does Unexpected token mean in JSON?

It means the parser found a character or value where it was not expected based on JSON syntax rules—often a missing comma, trailing comma, or unquoted key near the reported position.

What does Unexpected end of JSON input mean?

This usually means the JSON ended too early because of a missing bracket, missing brace, unfinished string, or incomplete payload.

How do I fix a JSON parse error quickly?

Use JSON Validator or Fix Invalid JSON to locate the issue, then repair the syntax and validate again—with JSON Repair when the text is messy.

Can copied API responses cause parse errors?

Yes. Truncated responses, encoding problems, or pasted extra characters can break otherwise valid JSON.

How do I debug large JSON parse errors?

Format the input with the JSON Formatter, inspect the reported line or character, then narrow the problem area step by step. After the document parses, JSON Minifier can help when you need a compact view.

Related Tools