JSON Formatter
About JSON Formatter
JSON (JavaScript Object Notation) is the most common data format for APIs and configuration files. This JSON formatter pretty-prints minified JSON with 2 spaces, 4 spaces or tabs, minifies it back to a single line, and validates it with the exact position of any syntax error.
It also accepts "relaxed" JSON that often shows up when copying from JavaScript code — single-quoted strings, unquoted keys and trailing commas — and converts it to valid JSON. Everything runs locally in your browser; your data is never uploaded.
How to use
- Paste your JSON into the input box.
- Click
Formatto beautify it,Minifyto compress it, orValidateto check it without changing it. - If the JSON is invalid, the error message shows the line and column of the problem.
- Copy the result, or use the share button to create a link with the current input.
FAQ
Why is my JSON invalid?
The most common causes are trailing commas, single quotes, unquoted keys, comments, and unescaped control characters inside strings. The formatter automatically fixes the first three; comments are not allowed in standard JSON and must be removed.
Is my data sent to a server?
No. Parsing and formatting use your browser's built-in JSON.parse and JSON.stringify. Nothing leaves your device.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation for readability. Minifying removes all unnecessary whitespace to make the payload as small as possible, which is useful for network requests and storage.
Does it support large numbers?
Numbers are parsed as JavaScript numbers, so integers larger than 2^53 - 1 (9007199254740991) lose precision. If you need exact large IDs, keep them as strings in your JSON.