JSON formatter

Formats and minifies JSON with syntax validation. Precise error message with line and column. Statistics on keys and nesting depth.

01Formatter02Stats03About04Questions05Related
01

Formatter and validator

Action
Indent
Input JSON
Result
Enter JSON on the left — result will appear here.
02

Document statistics

0
Input chars
0
Output chars
0
Output lines
0
Depth
0
Keys
03

About the JSON format

Data types

7 types
"str" · 42 · true · null · [ ] · { }
JSON supports 7 types: string, number, boolean, null, array, object. Numbers are unquoted; strings always use double quotes. Single quotes, comments, undefined and NaN are not part of the standard (JSON5 only).

Common mistakes

How to fix
trailing , · 'quotes' · {key: 1}
Trailing comma after the last element, single quotes instead of double, unquoted keys. Standard JSON.parse rejects them. JSON5 allows all of this, but it's not a web standard — only for configs.

Format / minify

20–40%
{"a":1} → {\n "a": 1\n}
Formatted JSON — for development: easy to read and diff in git. Minified — for API responses and network traffic. Savings are typically 20–40% and much more on large payloads.

JSON vs YAML/XML

When which
API → JSON · config → YAML/TOML
JSON — best for APIs and service-to-service data: minimal, everyone parses it, no ambiguity. YAML/TOML — for configs (comments, readability). XML — legacy enterprise/SOAP, usually overkill for new work.
04

Frequently asked questions

Paste the JSON and it is laid out with indentation and line breaks, turning a one-line dump into a readable structure. The indent is your choice: two spaces, four, or a tab. The reverse works too — minifying strips every optional space and newline, which is what you want before sending the payload.

Updated

«» added to favorites