Paste your JSON to format, validate and minify it instantly. This free JSON formatter beautifies messy or one-line JSON into readable, indented code, points to the exact line and column of any syntax error, and can automatically fix common mistakes like trailing commas, single quotes and comments. Everything runs in your browser, so your data never leaves your computer.
How to format JSON
- Paste your JSON into the Input box. Valid JSON is formatted automatically when you paste it.
- Press Format / Beautify (or Ctrl + Enter) to indent it, or Minify to remove all whitespace.
- Choose 2 spaces, 4 spaces or tabs for indentation, and tick Sort keys to order object keys alphabetically.
- Copy the result or Download it as a
.jsonfile.
How to validate JSON and find errors
The validator checks your JSON as you type. When it is valid you see a green bar with the data type, number of keys and nesting depth. When it is not, the red bar shows the line and column of the problem and what went wrong. Click Go to error to jump straight to it.
If your data is “almost JSON”, for example a JavaScript object or a Python dictionary, press Try to fix. It will:
- remove
//,/* */and#comments - convert
'single quotes'to"double quotes" - add quotes around unquoted keys like
{name: "Ali"} - remove trailing commas such as
[1, 2, 3,] - convert Python’s
True,FalseandNonetotrue,falseandnull
Always check the fixed result before using it, especially for data that matters.
Common JSON errors
- Unexpected token: usually a missing comma between items, a missing quote, or an extra character.
- Expected property name: a key is not wrapped in double quotes, or there is a trailing comma before
}. - Unexpected end of JSON input: a closing
}or]is missing, or the text was cut off. - Bad control character in string: a real line break or tab inside a string. Use
\nand\tinstead.
Frequently asked questions
Is my JSON data safe?
Yes. Formatting and validation happen entirely in your browser with JavaScript. Your JSON is not sent to our server or stored anywhere except your own browser’s local storage, so you can safely format API responses and config files.
What is the difference between formatting and minifying JSON?
Formatting (also called beautifying or pretty printing) adds line breaks and indentation so people can read the structure. Minifying removes all unnecessary whitespace to make the file as small as possible, which is better for sending over a network or storing.
Can it handle large JSON files?
Yes. It handles files of several megabytes comfortably. Very large files depend on your device’s memory, since everything is processed locally.
Does sorting keys change my data?
No. Sorting only changes the order of keys inside objects. Values and array order stay the same, and in JSON the order of object keys has no meaning.
Why does JSON not allow comments or single quotes?
The JSON standard is intentionally strict so every language can parse it the same way. Keys and strings must use double quotes, and comments and trailing commas are not allowed. Formats like JSON5 relax these rules, but most APIs expect strict JSON.
More free developer tools
Online HTML Editor
Write HTML, CSS and JavaScript and see a live preview as you type, with a built-in console and one-click download.
Open tool →Text & patternsRegex Tester
Test JavaScript regular expressions with live match highlighting, capture groups, replace mode, common patterns and a cheat sheet.
Open tool →