KKwikfig.

JSON Formatter & Validator

Format and validate JSON in your browser — pretty-print or minify with your choice of indent, and see the exact line and column when the syntax breaks. Runs entirely in your browser — your numbers never leave this device.

JSON input
Output
Valid
Yes
Input size
45
Output size
58

How it works

Pretty JSON = parse(text), then serialise with an indent of the chosen spaces per level | Minified JSON = parse(text), then serialise with no extra whitespace | Invalid input → the parser's error message plus its character position, shown as line and column

Paste JSON and the tool parses it with the browser's own JSON parser — the same strict grammar every API and config file is held to — then writes it back out in the shape you asked for: pretty-printed with 2, 4 or another indent you choose, or minified onto a single line. Formatting never changes the data: key order is preserved exactly as written, numbers keep their value, and strings keep their characters. What changes is only whitespace, which JSON ignores.

Validation is the same parse, read from the other side. If the text is not valid JSON, nothing is silently altered or tidied away — the tool reports the parser's own error message and, where the parser supplies one, the character position converted to a line and column, so you can jump straight to the fault. The usual culprits are a trailing comma after the last item, single quotes where JSON demands double quotes, unquoted keys, and comments, which JSON does not allow at all. A document that parses here will parse anywhere; a document that fails here names its own problem.

The privacy point matters most with this tool, because pasted JSON is so often real payload data — API responses, order records, user exports. Everything runs in your browser: the text you paste is never uploaded, stored or tracked, and it is gone when you close the tab.

Worked examples

Pretty-printing a compact object

Input
Text = {"name":"Amina","tags":["api","json"],"active":true}, Indent = 2 spaces
Working
The value is parsed, then serialised again with two spaces per nesting level: nested arrays and objects open onto their own lines, and the key order (name, tags, active) is kept exactly as written.
Result
{ "name": "Amina", "tags": [ "api", "json" ], "active": true }

Minifying for a config value or request body

Input
Text = { "name" : "Amina", "tags" : [ "api", "json" ] }
Working
The same parse, serialised with no optional whitespace at all: every space around colons, commas and brackets disappears, and nothing else changes.
Result
{"name":"Amina","tags":["api","json"]}

A trailing comma, located precisely

Input
Text = {"name":"Amina",}
Working
JSON does not allow a comma after the last property. The parser stops at the closing brace and reports: Expected double-quoted property name in JSON at position 16 — character 16 of the input, which is line 1, column 17. Delete the stray comma and the same text formats cleanly.
Result
Invalid JSON — error at line 1, column 17 (character position 16)

Frequently asked questions

Does formatting change my JSON in any way?

Only the whitespace. The tool parses the text into a value and serialises that same value back, so keys stay in their original order, numbers keep their value and strings keep every character. Pretty-printing and minifying are exact inverses: minify a pretty document and format it again and you get the identical text back.

Why does my JSON fail here but work in my code?

Almost always because the source was not strict JSON: JavaScript object literals allow trailing commas, single-quoted strings, unquoted keys and comments, and JSON allows none of them. Python dictionaries with True/None instead of true/null fail the same way. The error position points at the first place the strict grammar breaks.

Can this fix broken JSON for me?

No — deliberately. The tool shows you the parser's message and the line and column of the fault so you can fix the one character that is wrong, rather than guessing at your data and changing it silently. In the worked example, removing a single trailing comma at column 17 turns an invalid document into a valid one.

What indent should I use for pretty-printing?

Two spaces is the most common convention in APIs and JavaScript projects, four spaces is common in Python and Java codebases, and tabs suit teams that set width per editor. The data is identical either way — match the codebase the JSON is going back into.

Is there a size limit?

There is no upload and no server-side limit; the practical limit is your browser's memory and patience. Documents of a few megabytes format in well under a second on a typical laptop. Extremely deep nesting can hit the parser's own stack limit, which the tool reports as an error rather than hiding.

Is the JSON I paste sent anywhere?

No. Parsing and formatting run 100% in your browser — payloads, exports and config files never leave your device, are never stored, and there is no history once you close the tab.

Related tools

More in Developer Tools · Browse all tools