Youtilities

Popular

All tools

JSON Formatter

Format, minify, and validate JSON. Shows the exact line of any error.

Runs in your browser. Nothing is uploaded.

Input

Waiting for JSON

Output
Formatted JSON appears here.

What this does

Paste JSON or drop a file. You get it back indented and readable, or squeezed onto one line for sending over the wire. If the JSON is broken, the status line tells you the line and column.

Is my data uploaded?

No. Formatting happens in your browser with the built-in JSON parser. Nothing is sent anywhere, so it is safe for API keys and customer data.

Sort keys

Turn on Sort keys to order every object alphabetically. Two responses formatted this way can be compared line by line.

Which indentation should I pick?

Use whatever your project already uses. 2 spaces is the most common choice for JavaScript and web projects, 4 spaces is common in Python and Java codebases, and Tabs suits teams that let each person set their own width. Minify removes every space and line break, which makes the file smallest for sending or storing. The download button saves the output as formatted.json or minified.json.

Why is my JSON invalid?

JSON is stricter than JavaScript. Keys and strings need double quotes, the last item in a list or object cannot have a comma after it, and comments, undefined and NaN are not allowed. The status line under the input shows the line and column where reading stopped; the real mistake is often just before that point, such as a missing comma at the end of the previous line.

Can formatting change my data?

Values stay the same in almost every case, with two things to know. If an object has the same key twice, only the last one is kept. Whole numbers larger than 9,007,199,254,740,991, such as some 64-bit IDs, are rounded by the browser's JSON reader, so check long numeric IDs in the output or keep them as strings.

All json tools