How to use the JSON Formatter
- Paste JSON into the "JSON" box on the left, or press "Sample" to load example data.
- Choose the indentation (2 spaces, 4 spaces or Tab) and the mode (Beautify or Minify); turn on "Sort keys" if needed.
- The result updates instantly on the right. If the JSON is invalid, the status bar shows the line and column of the error.
- Press "Copy" to paste it back into your code, or "Download" to save a .json file.
Examples
Pretty-print one-line JSON with 2-space indentation
{"id":1024,"name":"Otaku Dojo","tags":["json","tools"],"active":true}
{
"id": 1024,
"name": "Otaku Dojo",
"tags": [
"json",
"tools"
],
"active": true
}
Find a syntax error: trailing comma
JSON does not allow trailing commas; the formatter points to the error position.
{
"a": 1,
"b": 2,
}
Syntax error near line 4, column 1: trailing commas are not allowed
Most common JSON syntax errors
- Trailing commas:
[1, 2,]or{"a": 1,}work in JavaScript but not in JSON. - Single quotes: strings and keys must use double quotes
". - Unquoted keys:
{name: "a"}must be{"name": "a"}. - Comments: standard JSON does not support
//or/* */. - Special values:
undefined,NaNandInfinityare not valid JSON.
Specs & key facts
| Standard | RFC 8259 / ECMA-404 |
|---|---|
| Processing | In your browser (nothing is uploaded) |
| Indentation | 2 spaces, 4 spaces, Tab |
| Other features | Minify, sort keys alphabetically, tree view, error line and column |
| File size | Up to about 10 MB, depending on device memory |
| Price | Free, no sign-up |
FAQ
What is the difference between formatting and validating JSON?
Formatting re-indents JSON so it is easy to read; validating checks that the syntax is correct. This tool validates first and only outputs a result when the JSON is valid, otherwise it shows where the error is.
Why does it report an error at line X, column Y?
That is where the parser first met an invalid character. The real mistake is often just before it — a missing or extra comma, or an unclosed quote.
Can it format JSON with comments (JSONC)?
No. Standard JSON does not allow comments; remove // and /* */ comments before pasting.
Does sorting keys change my data?
No. Only the order of keys inside objects changes; values and array order stay the same, and JSON objects are unordered by definition.
Is it safe to paste production API responses?
Yes. Formatting runs entirely in your browser and the content is never sent to a server.