FORMATFYCOM formátovač · validátor · minifikátor About

What's new

JSON Formatter & Validator

Format and validate JSON online. Fixes trailing commas, quotes, comments and JavaScript or Python notation. Free, in your browser.

Input

Output


      

How to format and validate JSON

The formatter turns one-line or messy JSON into neatly indented JSON, checks it against the RFC 8259 spec, and when it finds an error it explains it, points to the exact spot and offers a fix — even for JavaScript or Python notation.

  1. Paste your JSON

    Copy an API response, a config or an export, drop a file, or click Sample.

  2. Format or minify

    Indent with 2 or 4 spaces or tabs, optionally sort keys. Ctrl+Enter formats, Ctrl+G jumps to a line.

  3. Fix errors in one click

    Each error shows the exact spot with an arrow and a fix button. “Fix everything” applies all safe fixes at once.

JSON errors the formatter detects and fixes

The most common reasons JSON won’t parse — with the messages browsers and Python print. If you got one of these, paste your JSON above.

Trailing comma

JavaScript tolerates it, JSON doesn’t.

["a", "b",]→["a", "b"]
Typical messages: Unexpected token ']', … is not valid JSON (Chrome / Node), Expecting value (Python)
✓ fixed automatically

Single quotes and unquoted keys

JavaScript or Python notation — JSON requires double quotes for strings and keys.

{'name': 'Jane', age: 30}→{"name": "Jane", "age": 30}
Typical messages: Expected property name or '}' in JSON (Chrome / Node), Expecting property name enclosed in double quotes (Python)
✓ fixed automatically

True, None, undefined, NaN

Python and JavaScript values JSON doesn’t know. Note: Python itself accepts NaN in JSON, other languages don’t.

{"ok": True, "x": None}→{"ok": true, "x": null}
Typical messages: Unexpected token 'T', … is not valid JSON (Chrome / Node), Expecting value (Python)
✓ fixed automatically

Comments

JSON has no // or /* */ — only JSONC / JSON5 do (VS Code, tsconfig).

{"port": 80 // web}→{"port": 80}
Typical messages: Expected ',' or '}' after property value in JSON (Chrome / Node), Expecting ',' delimiter (Python)
✓ fixed automatically

Missing comma or colon

Items need commas between them, keys need a colon before the value.

{"a": 1 "b" 2}→{"a": 1, "b": 2}
Typical messages: Expected ':' after property name in JSON (Chrome / Node), Expecting ':' delimiter (Python)
✓ fixed automatically

Backslashes and tabs in strings

Paths like C:\\temp need a doubled backslash, \' doesn’t exist in JSON, a tab is \t.

{"q": "it\'s"}→{"q": "it's"}
Typical messages: Bad escaped character in JSON (Chrome / Node), Invalid \escape (Python), Bad control character in string literal (Chrome / Node)
✓ fixed automatically

Unterminated string or truncated file

A closing quote or brackets are missing — typically a truncated log or export.

{"a": [1, {"b": 2→{"a": [1, {"b": 2}]}
Typical messages: Unterminated string in JSON (Chrome / Node), Unterminated string starting at (Python)
✓ fix offered

Several JSON documents (NDJSON)

JSON Lines from logs, or JSON inside var data = … or callback(…). Combined into an array or extracted.

{"a":1}↵{"a":2}→[{"a":1}, {"a":2}]
Typical messages: Unexpected non-whitespace character after JSON (Chrome / Node), Extra data (Python)
✓ fix offered

…and more: typographic quotes, numbers like 01, +1, .5 or 0x1F, empty values, \u without 4 hex digits.

FAQ

What does “Unexpected token in JSON at position” mean?

The parser hit a character it doesn’t expect there — usually an extra comma, a single quote or a comment. The browser only gives a position; the formatter shows the line, column and cause.

Why doesn’t JSON allow comments or trailing commas?

The spec is deliberately minimal for portability. Comments and trailing commas are allowed in JSON5 / JSONC; remove them for APIs.

Can it sort keys or minify JSON?

Yes — the “sort keys” option and the Minify button. To convert to other formats use JSON → CSV, YAML or XML.

Is it free, without sign-up?

Yes. No sign-up, no ads and no size limit — the only limit is your computer.

Is my data sent to a server?

No. Everything runs in your browser and the data you paste never leaves it — fine even for data with tokens or personal information.

Related tools