Indent
Mode
JSON
Result
Results appear as you typeShortcut: Ctrl + Enter to run

How to use the JSON Formatter

  1. Paste JSON into the "JSON" box on the left, or press "Sample" to load example data.
  2. Choose the indentation (2 spaces, 4 spaces or Tab) and the mode (Beautify or Minify); turn on "Sort keys" if needed.
  3. The result updates instantly on the right. If the JSON is invalid, the status bar shows the line and column of the error.
  4. 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

Input
{"id":1024,"name":"Otaku Dojo","tags":["json","tools"],"active":true}
Output
{
  "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.

Input
{
  "a": 1,
  "b": 2,
}
Output
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, NaN and Infinity are not valid JSON.

Specs & key facts

StandardRFC 8259 / ECMA-404
ProcessingIn your browser (nothing is uploaded)
Indentation2 spaces, 4 spaces, Tab
Other featuresMinify, sort keys alphabetically, tree view, error line and column
File sizeUp to about 10 MB, depending on device memory
PriceFree, 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.