Skip to content

JSON Formatter & Beautifier

Pretty print JSON with clean indentation, optional key sorting and exact error locations.

JSON input

Tab inserts indentation. Press Escape, then Tab, to move focus out of the editor.

Formatted JSON

How to format JSON

  1. Paste your JSON on the left, or open or drop a .json file.
  2. The pretty-printed JSON appears on the right as you type. Choose 2 spaces, 4 spaces or tabs.
  3. Turn on Sort keys A–Z to order object keys alphabetically.
  4. Copy the result or Download it as a .json file.

Beautify minified JSON into readable structure

API responses, logs and exported data usually arrive as one long line. The JSON formatter adds line breaks and indentation so you can see how objects and arrays nest — and spot the field you're looking for.

Minified
{"user":{"id":7,"roles":["admin","editor"],"active":true}}
Pretty printed
{
  "user": {
    "id": 7,
    "roles": [
      "admin",
      "editor"
    ],
    "active": true
  }
}

Why use this JSON beautifier

  • Lossless: values are printed exactly as written, so large IDs like 12345678901234567890 aren't rounded and 1.0 stays 1.0.
  • Sort keys: alphabetical keys at every level make diffs and reviews easier.
  • Precise errors: invalid JSON shows the line, column and a plain-language reason, with the line highlighted.
  • Private: everything runs in your browser; nothing is uploaded.

Use cases

  • Read an API response from curl, Postman or the browser's network tab.
  • Normalise package.json, tsconfig.json or other config files before committing.
  • Compare two JSON files: format both with sorted keys, then diff them.

Related JSON tools

If the JSON doesn't parse, the JSON validator explains the error and can repair common mistakes. To go the other way — the smallest possible file — use the JSON minifier. For editing with live validation, open the online JSON editor, and to turn JSON into a config file, try JSON to YAML. Working with XML instead? The XML formatter does the same for XML.

Frequently asked questions

Does formatting change my JSON data?
No. Only whitespace changes. Numbers keep their exact text (1.0 stays 1.0, very large integers aren't rounded), strings keep their escapes, and key order is preserved unless you choose Sort keys.
What does “Sort keys A–Z” do?
It orders the keys of every object alphabetically, at all levels. That makes two JSON documents easy to compare in a diff and gives config files a predictable order. Arrays keep their order.
What if my JSON has an error?
The formatter shows the line and column of the first error with a short explanation and highlights the line. The JSON validator can also repair common mistakes such as trailing commas automatically.
Is there a size limit?
Formatting runs in your browser, so the limit is your device's memory. Files of several megabytes usually format in about a second on a typical laptop.