Formatters

Format and prettify JSON

JSON Formatter re-indents the JSON you paste, four spaces per nesting level by default, or two spaces or a tab if you change "Indent". API developers use it to read minified responses, inspect dumped configs and build readable payload examples. The text is checked with JSON.parse and then laid out token by token, so key order, number spelling (1.50, 1e3) and integers beyond 2^53 come out exactly as you wrote them; only whitespace changes. Malformed input, such as a stray comma or a single-quoted key, shows the parser's error message instead of a guessed fix.

How to use JSON Formatter

  1. Open JSON Formatter in the Toolbox101 app.
  2. Paste the JSON you want to read, a minified API response say, into the JSON box.
  3. Pick Indent: 2 spaces, 4 spaces (the default) or Tab.
  4. Read the formatted JSON in the Output box. It appears as soon as the input parses.
  5. Click Copy to take it, or paste it straight into your editor.

Worked example

JSON Formatter returns the output below for this input.

Input

{"name":"toolbox101","version":"1.0","enabled":true,"tags":["json","xml","crypto"]}

Output

{
    "name": "toolbox101",
    "version": "1.0",
    "enabled": true,
    "tags": [
        "json",
        "xml",
        "crypto"
    ]
}

Check it yourself: open JSON Formatter and enter the same input.

Frequently asked questions

Why does my JSON fail with single quotes?

JSON is a strict format: keys and strings must use double quotes, comments are not allowed and trailing commas are invalid. The tool checks the text with the standard JSON.parse, so single-quoted JSON, unquoted keys and trailing commas all produce the browser's error message, which usually names the position of the problem.

Does formatting change my values or reorder my keys?

No. Only whitespace changes. Key order is kept, and every value keeps its exact text: numbers such as 1.50 or 12345678901234567890 come through as written, not rounded through a JavaScript number.

Can I use tabs or two spaces instead of four?

Yes. The Indent list offers 2 spaces, 4 spaces or a tab, and the output updates as soon as you change it.

What is the difference between formatting and validating JSON?

Formatting re-indents valid JSON; validating only reports whether JSON is well-formed. This tool parses first, so invalid input is reported as an error instead of being formatted, but it shows just the first error. The JSON Validator tool is the one to use when all you want is a yes or no.

Use JSON Formatter now

Runs in your browser. Nothing you type is uploaded.