JSON FormatterONLINE

Pretty print JSON with predictable indentation and a separate, copyable result.

JSON
{
  "project": "Something worth building",
  "version": 1,
  "isPublic": true,
  "stack": [
    "Astro",
    "TypeScript",
    "JSON"
  ],
  "settings": {
    "theme": "light",
    "indent": 2
  },
  "description": null
}
Preparing editor…
Strict JSON · RFC 8259
Your JSON stays in your browser. Core processing happens locally.
Keyboard shortcuts & workspace limits

Ctrl / ⌘ + Enter runs the primary action. Ctrl / ⌘ + F searches the focused editor. Ctrl / ⌘ + Z undoes; add Shift to redo. Tab moves focus. Esc restores the expanded workspace.

Up to 10 MiB UTF-8 input, 128 nesting levels, and 32 Mi characters of output. The tree preview shows at most 2,000 nodes with bounded text. Syntax highlighting is disabled above one million characters; documents above 250,000 characters run on request. Export before reloading: documents are kept in memory, not saved.

THE PRACTICAL GUIDE

Pretty print JSON while keeping the original values intact

Formatting adds indentation and line breaks so a compact JSON document becomes easier to read and review. The source and formatted output remain separate.

When should you use it?

  • Read a one-line API response.
  • Prepare a diff-friendly sample for documentation.
  • Inspect nested arrays without changing their values.
WORKED EXAMPLE

Example: format a compact response

Only structural whitespace changes. Names, values, and array order stay the same.

Input
{"name":"Alex","roles":["author","reviewer"]}
Formatted result
{
  "name": "Alex",
  "roles": [
    "author",
    "reviewer"
  ]
}

Why preserving source tokens matters

A conventional parse-and-stringify formatter first converts JSON into language values. That intermediate step can change a large integer or rewrite number notation. This formatter works from the source tokens, so 9007199254740993, 1e3, and an escaped string keep their original spelling. Only whitespace outside strings is rearranged.

That makes the result useful for inspecting financial identifiers, exported database keys, and reproducible bug reports. It does not make every downstream parser precision safe; the application that eventually consumes the JSON still needs a suitable number representation.

Use indentation to reveal structure

Choose a consistent indentation width when preparing an example for a repository. Smaller indentation is convenient for deeply nested data; wider indentation can make short configuration files easier to scan. If you need to compare two payloads, format both with the same settings or use path comparison in JSON Diff to avoid differences caused only by layout.

AT THE WORKBENCH

A readable copy. An untouched source.

Format compact API responses into consistently indented JSON. Keep the input beside the result to review it, then copy or download the formatted document.

  1. Open the compact response

    Paste JSON or drag a local file into the workspace.

  2. Choose indentation

    Use two spaces, four spaces, or tabs.

  3. Export the formatted copy

    Copy or download; replace the source only when you choose.

IN PRACTICE

How can I pretty print one-line JSON without rounding a large integer?

Paste the original JSON text into Formatter and choose an indentation width. The core formatter rewrites whitespace around tokens, so it keeps a number such as 9007199254740993 spelled exactly as received. A JavaScript parse-and-stringify round trip can lose that precision.

JSON: precision-sensitive input to paste

json
{"invoice":{"id":9007199254740993,"paid":false}}

The formatted result places invoice fields on separate lines but retains the same id token. Keep identifiers as strings in systems that cannot represent large integers exactly.

Formatting requires valid JSON and changes only structural whitespace. Use Validator for an error location or Repair for a reviewed syntax suggestion.

BEFORE YOU USE THE RESULT

What should you check before using the result?

Formatting does not repair missing commas, verify schema rules, or shrink a payload. Use Minifier for compact transport and Validator for a precise syntax diagnostic.

Formatting preserves source tokens

Only whitespace outside strings changes. Large integers, decimal precision, exponent spelling, escaped strings, duplicate keys, array order, and object member order are preserved. Formatting does not sort or normalize values.

From formatting to editing

The input is editable and the output is read only. Use “Use result as input” to continue working on the formatted version, or open the editor for a format-in-place workflow. Undo restores the previous source.

Understand JSON syntax

Technical reference: JSON syntax and interoperability · RFC 8259

THE JSON FIELD GUIDE
All guides