JSON Beautifier

Pretty-print JSON with 2-space, 4-space or tab indentation.

  • Runs locally in your browser
  • No upload required

Try it

Paste JSON. It is pretty-printed in your browser and never uploaded.

Beautified JSON
{ "name": "gampangin", "tags": [ "json", "beautify" ] }
{
  "name": "gampangin",
  "tags": [
    "json",
    "beautify"
  ]
}

Supported formats

Input
text
Output
text

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Beautified 17 characters of JSON with 2-space indentation.

How it works

  • Scanned the JSON into a syntax tree without converting number literals to JavaScript numbers.
  • Re-emitted the tree with 2-space indentation and a stable key order.
  • The beautified output is 39 characters long.

Methodology

  1. Tokenize the document with the F054 verbatim JSON scanner.
  2. Validate the token stream against RFC 8259 before transforming anything.
  3. Re-emit the tokens with the chosen indentation.

Usage

  1. Paste or type a JSON document.
  2. Choose 2 spaces, 4 spaces or a tab.
  3. Run the tool and copy the beautified JSON.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

Two-space indentation

jsonSelect to copy
{
  "text": "{\"a\":1,\"b\":[2,3]}",
  "indent": "2"
}

Four-space indentation

jsonSelect to copy
{
  "text": "{\"a\":{\"b\":1}}",
  "indent": "4"
}

Big integer preserved

jsonSelect to copy
{
  "text": "{\"id\":123456789012345678901234567890}",
  "indent": "2"
}

Limitations

Choosing an indentation

Two spaces is the common default, four spaces matches many editors, and a tab matches tab-indented projects. The value itself never changes.

Frequently asked questions

How is this different from the JSON Formatter?
It is the focused pretty-print surface: choose an indentation and get the formatted document, without the broader workspace editor.
Does it change my values?
No. Number literals and string contents are preserved exactly; only insignificant whitespace is added.
Is my data uploaded?
No. The document is processed entirely in your browser and is never sent anywhere.

Sources

  1. RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format — IETF
  2. MDN Web Docs — JSON.stringify() — MDN