JSON Formatter & Validator

Paste JSON to validate it and pretty-print it with clean indentation, or minify it to a single line. Parsing and formatting happen in your browser, so your data never leaves your device.

Paste JSON above and press Format JSON.

What formatting does

JSON (JavaScript Object Notation) is a strict, text-based data format. Beautifying re-prints it with consistent indentation so the structure of objects { } and arrays [ ] is easy to read; minifying strips all optional whitespace to make the smallest valid payload for storage or transfer. The data itself is unchanged — only the spacing differs.

parse(text) validate stringify(value, indent)

This tool parses your input with the browser's native JSON.parse, so it follows the official JSON grammar exactly: double-quoted keys and strings, no trailing commas, and no comments. If it parses, it re-serializes with your chosen indentation.

Worked example

Minified input {"a":1,"b":[2,3]} with 2-space indentation becomes:

Line 1: {
Indented:   "a": 1, then   "b": [
Result: a readable, properly nested document — same data, clearer shape.

Validation and error messages

Invalid JSON can't be formatted, so the tool first validates. Common mistakes are single quotes instead of double, a trailing comma after the last item, unquoted keys, or a stray bracket. When parsing fails, the browser reports the position of the problem so you can find it. Valid JSON always uses double quotes around keys and string values and never ends a list or object with a comma.

Tip: need to turn a spreadsheet into JSON instead? Use the CSV to JSON converter.

Frequently asked questions

What's the difference between beautify and minify?

Beautifying adds indentation and line breaks so JSON is easy to read; minifying removes all unnecessary whitespace to make the file as small as possible. Both keep the data identical — only the formatting changes.

Why does my JSON say it's invalid?

The most common causes are single quotes instead of double quotes, a trailing comma after the last element, unquoted keys, or comments (which JSON doesn't allow). The error message points to the position where parsing failed.

Can I sort the keys?

Yes. Choose 'Sort keys A→Z' and the formatter re-orders every object's keys alphabetically, recursively. This is handy for diffing two JSON documents that have the same data in a different order.

Is my JSON sent to a server?

No. Parsing and formatting use the browser's built-in JSON engine on your device. Nothing you paste is uploaded or stored, so it's safe for sensitive data.

MB
Mustafa Bilgic · Editor, Calcool
Formatting uses the browser's native JSON.parse/JSON.stringify, which follow the official JSON grammar. Everything runs in your browser — nothing you enter is uploaded, logged or stored.

Related calculators