JSON Formatter and Validator Free
Format JSON for readability or minify it to one line. It checks the syntax as you type and shows the line and column of any error.
About this tool
Choose 2-space, 4-space, or tab indentation, and optionally sort object keys alphabetically.
Integers outside the safe range of ±9,007,199,254,740,991 (about 16 digits) may lose trailing digits when formatted, since JavaScript cannot always represent them exactly. The tool flags this when it happens.
This tool runs entirely in your browser. Nothing you enter is sent to our server.
When to use it
Useful for taking a one-line JSON response from an API or a log file and turning it into something you can actually read, with the nesting visible.
Also useful for checking a hand-edited config file for a missing comma or an unclosed bracket before you use it.
How to use
- Paste JSON into the input box, drop a file onto it, or use "Open file".
- The tool checks the syntax as you type and shows either a confirmation or the line and column of the error.
- Click "Format" to add indentation, or "Minify" to collapse it to one line. Copy or save the result.
Common mistakes
A trailing comma after the last item (like [1, 2,]), single quotes around keys or strings, and comments (// or /* */) are all invalid in JSON, even though JavaScript itself allows them.
FAQ
- Why did the end of a number change after formatting?
- Integers outside the safe range of ±9,007,199,254,740,991 (about 16 digits) can't always be represented exactly by JavaScript's number type, so formatting can change their trailing digits. The tool warns you when this happens. For IDs or other large numbers, keep them as strings (in quotes) in the JSON to avoid this.
- Does sorting keys also reorder array items?
- No. Sorting only reorders the keys within objects; the order of items inside arrays is left as-is.
- Is my JSON sent anywhere?
- No. Checking and formatting happen entirely in your browser.