MockFoxAdvertise

JSON Formatter & Beautifier

Updated Free mock REST & WebSocket APIs

Paste messy or minified JSON to pretty-print it with clean indentation, or minify it for a payload. Mistakes are pinpointed by line and column, and everything runs in your browser — nothing is uploaded.

231 characters · 10 keys · depth 2

🔒 Runs in your browser — nothing you paste is uploaded.

How to format JSON

  1. Paste or type JSON into the input box — it's formatted as you type.
  2. Choose Beautify or Minify, the indentation (2 spaces, 4 spaces or tab) and whether to sort keys alphabetically.
  3. Copy the result, download it as formatted.json, or switch to Tree view to collapse and explore nested objects.

Common JSON errors and how to fix them

ErrorBrokenFixed
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
Unquoted key{a: 1}{"a": 1}
Comment{"a": 1 // id}{"a": 1}
Python/JS literal{"ok": True, "x": None}{"ok": true, "x": null}
Raw line break in string"line 1⏎line 2""line 1\nline 2"

JavaScript object literals allow trailing commas, comments and unquoted keys, so JSON copied from source code often breaks on exactly these. The formatter tells you which one it is and where.

Beautify, minify or sort keys?

Beautified JSON is for people: code reviews, docs and debugging an API response. Minified JSON strips every insignificant space and line break, which typically makes payloads 10–30% smaller before compression — handy for request bodies, environment variables and test fixtures. Sorting keys gives a stable order, so two versions of the same object produce a clean diff.

One caveat: JSON numbers are parsed as JavaScript doubles, so integers above 9,007,199,254,740,991 (253 − 1) lose precision when formatted in any browser tool. That's why APIs such as Twitter's send large IDs as strings.

Related tools

Frequently asked questions

Is my JSON sent to a server?

No. This tool runs entirely in your browser with JavaScript, so your JSON never leaves your device and isn't logged or stored. You can even use it offline once the page has loaded.

What's the difference between a JSON formatter and a JSON validator?

A formatter rewrites valid JSON with consistent indentation (or none, when minifying). A validator only checks whether the text is valid and explains errors. This formatter validates first, so it also shows you any error with its line and column.

Why did a long number change after formatting?

Integers larger than 2^53 − 1 can't be represented exactly as JavaScript numbers, so they're rounded when parsed. Keep big IDs as strings in your JSON to avoid this.

Can it format JSON with comments (JSONC or JSON5)?

No — comments, trailing commas and single quotes aren't valid JSON, so the tool points them out instead. Remove them and the JSON will format.

Your business here? Sponsor this tool from $16/week. See placements