JSON formatter and validator
Format, minify and validate JSON in your browser. Shows where a syntax error is. Nothing is uploaded.
Runs in your browser. Nothing you enter is uploaded.
What it does
Paste JSON to check that it is valid and to lay it out with consistent indentation, or to squeeze it onto one line. If the JSON is invalid, the tool reports the parser’s error and the line and column where it stopped.
How to use it
- Paste or type JSON in the box.
- Choose the indent, and whether to sort object keys.
- Press Format to beautify or Minify to remove all spacing.
- Copy the result or download it as a .json file.
Worked example
Input {"b":1,"a":[true,null]} with 2-space indent and sorted keys becomes:
{
"a": [
true,
null
],
"b": 1
}
How it works
The text is parsed with the browser’s own JSON.parse, which follows the JSON standard strictly, and written back with JSON.stringify. Strict means: property names and strings need double quotes, and trailing commas, comments and undefined are not allowed.
Questions
Is my text sent to a server?
No. Everything runs in your browser. Nothing you type is uploaded or stored by us.
Why is my JSON invalid when it works in JavaScript?
JavaScript object literals allow single quotes, unquoted keys, comments and trailing commas. JSON does not.
Are large numbers safe?
Numbers beyond about 9 quadrillion (2^53) lose precision when parsed, as they do in any JavaScript program. Keep such IDs as strings.
Does formatting change my data?
It changes only spacing, and key order if you ask for sorting. Duplicate keys in an object are reduced to the last one, as the parser does.
Related tools
Need an app or website for your shop? See how to hire us →