JSON Formatter and Beautifier

Paste JSON to beautify it with 2-space, 4-space or tab indentation, minify it to one line, sort keys and explore it in a collapsible tree. This JSON formatter keeps every number exactly as written.

Press Ctrl+Enter (⌘+Enter on Mac) to run now.

Changes made by the repair
    Valid JSONInvalid JSONKeyValue Linecolumn

    Format and Beautify JSON Online

    API responses and log lines often arrive as one unreadable line of JSON. This JSON formatter re-indents the data so every key sits on its own line and the nesting is visible at a glance, or does the opposite and minifies pretty-printed JSON into the smallest valid form for a request body or a config value.

    Unlike formatters that run your data through JSON.parse and back, it copies numbers and strings exactly as written: 1250.50 keeps its trailing zero and an ID like 9007199254740993 keeps every digit. Formatting happens in your browser, so the JSON you paste is never uploaded.

    Minified JSON formatted into indented lines{"a":[1,2]}{ "a": [JSONFormatter

    How to format JSON

    1. Paste your JSON into the input box, open a .json file, or load the sample. The output updates as you type.
    2. Choose Beautify or Minify. Beautify adds line breaks and indentation; Minify removes all whitespace outside strings.
    3. Pick the indentation (2 spaces, 4 spaces or tabs), and optionally sort keys alphabetically or change how Unicode characters are written.
    4. Explore the structure in the tree view. Hover a node to see its path, such as $.orders[0].sku.
    5. Copy or download the result as formatted.json.

    If the input is not valid JSON, the formatter shows the line and column of the first problem with a hint. For a deeper check with a highlighted error view, statistics and automatic repairs, use the JSON validator.

    Formatting options at a glance

    OptionInputOutput
    Beautify, 2 spaces{"a":[1,2]}{ /   "a": [ /     1, … on separate lines
    MinifyIndented JSON{"a":[1,2]}
    Sort keys A–Z{"b":1,"a":2}{"a":2,"b":1} (nested objects too, arrays keep their order)
    Keep as written"Caf\u00e9""Caf\u00e9"
    Unescape \u sequences"Caf\u00e9""Café"
    Escape non-ASCII"Café 😀""Caf\u00e9 \ud83d\ude00"
    Empty containers{ }, [ ]{}, []

    Characters outside the Basic Multilingual Plane, such as most emoji, are escaped as a surrogate pair of two \u sequences, which is how the JSON specification (RFC 8259) escapes them.

    What the formatter changes, and what it keeps

    Formatting only changes whitespace between tokens. Everything that carries meaning is copied as-is:

    • Numbers are not rounded or rewritten. 1.50, 1e3 and -0 stay exactly as typed, and integers beyond JavaScript’s safe range (9,007,199,254,740,991) keep all their digits. Tools that re-serialise parsed values would print 1.5, 1000, 0 and a rounded ID.
    • Strings keep their escapes (\n, \", \u00e9) unless you choose one of the Unicode options.
    • Key order is preserved unless you tick “Sort keys”. Sorting is stable and compares keys by their character codes, so uppercase letters come before lowercase ones.
    • Duplicate keys are kept. JSON parsers usually keep only the last value; the formatter shows both so nothing disappears silently. The validator lists them as warnings.

    Using the tree view

    The tree shows each object and array with the number of entries inside its brackets, for example {4} for an object with four keys and [25] for an array of 25 items. Click a row to open or close it. Children are built only when a node is opened, each level lists at most 500 entries, and “Expand all” stops after roughly 3,000 nodes so the page stays responsive. The tooltip on every row shows its path in $.key[0] notation, as used by JSONPath and jq.

    Tips for working with JSON

    • Large files are formatted after a short pause in typing, not on every keystroke.
    • Diffing two files: beautify both with “Sort keys” on and the same indentation, then compare them. Only real differences remain.
    • Need types or another format? Generate interfaces with JSON to TypeScript, convert to a spreadsheet with JSON to CSV, or turn a config into YAML with JSON to YAML.
    • One JSON object per line? That is JSON Lines, not a single JSON document. Check it with the JSONL validator.

    Frequently Asked Questions

    Common questions about formatting JSON.

    Paste the JSON into the input box and choose Beautify. The formatted JSON appears on the right with the indentation you picked; copy it or download it as a .json file.

    Beautify adds line breaks and indentation so people can read the structure. Minify removes every space and line break outside strings, which makes the text smaller for storage and network transfer. Both describe exactly the same data.

    All three are valid JSON. Two spaces is the most common choice in JavaScript projects and the default of many tools, four spaces is common in Python and Java code bases, and tabs let each reader choose the width.

    No. Numbers are copied exactly as written, so 1.50 keeps its trailing zero and long IDs keep every digit. Only the whitespace between values changes.

    It writes every character above U+007E as a \uXXXX escape, for example é as \u00e9. The data stays the same, but the file contains only ASCII, which helps with systems that mishandle UTF-8.

    The input breaks a JSON rule, such as a trailing comma, single quotes or a comment. The message shows the line and column. The JSON validator can repair the most common mistakes for you.

    Yes. Files of several megabytes are formatted in your browser, and the tree view builds nodes only when you open them.

    No. Parsing and formatting run in JavaScript on your device, and downloads are created locally.