Input
Output
Empty Formatting runs in your browser

Online JSON Beautifier

Turn minified, one-line JSON into neatly indented code you can actually read. The JSON beautifier pretty prints your data in an editable code view, so you can tidy it up, sort the keys and compact it again when you are done. Errors are flagged by line before you waste time on broken input.

How to beautify JSON

  1. Paste minified or messy JSON into the left editor, or open or drop a .json file.
  2. The beautified JSON appears in the right editor, indented and highlighted. Press Format or Ctrl+Enter if Live is off.
  3. Edit the beautified JSON directly in the right editor if you need to. It is a full code editor, not a read-only preview.
  4. Copy it, download it, or press the left arrow between the editors to move it back to the input for another pass.

Beautify, pretty print, format: what is the difference?

Nothing important. "Beautify", "pretty print" and "format" all mean adding line breaks and indentation so JSON is readable. This page opens the result in an editable code view, which suits cleaning up a file you are about to commit. The JSON Formatter shows a fast preview, and the JSON Viewer opens a collapsible tree. Pick whichever view fits the job.

The opposite of beautifying is minifying: removing every optional space so the JSON is as small as possible. Press Compact to do that here, or use the JSON Minifier to see how many bytes you save.

When you need a JSON beautifier

Example

{"user":{"id":7,"name":"Grace Hopper","roles":["admin","editor"]},"active":true}

beautified with two-space indentation:

{
  "user": {
    "id": 7,
    "name": "Grace Hopper",
    "roles": [
      "admin",
      "editor"
    ]
  },
  "active": true
}

Tips for cleaner JSON

Sort keys

Choose Sort keys from the editor's ⋯ menu to put keys in alphabetical order. Two files with sorted keys are much easier to compare, by eye or with JSON Compare.

Choose the indentation

Set the Indent selector to match your project, usually 2 or 4 spaces. Indentation does not change the data, only how it looks.

Fix errors before you beautify

A beautifier needs valid JSON. If the status line reports an error, the JSON Validator shows exactly where it is, and JSON Repair can fix trailing commas, single quotes, comments and missing brackets automatically.

Make the editor comfortable

Open the settings dialog to pick a coding font, a larger size or a colour theme, and to turn on line wrapping for long strings.

Beautify JSON in your editor

If the JSON is already in a file, your editor can usually beautify it too: Shift+Alt+F in VS Code, Ctrl+Alt+L in IntelliJ IDEA and other JetBrains IDEs, or a "Pretty JSON" package in Sublime Text. On the command line, jq . file.json and python -m json.tool file.json do the same. The online JSON beautifier is the fastest option when the JSON is on your clipboard or you are not on your own computer.

Free, fast and private

This JSON beautifier is free, has no limits and needs no account. It runs in your browser, so the JSON you paste is never uploaded, and you can save your work in the browser or share it with a link when you choose to.

Frequently asked questions

What is a JSON beautifier?

A JSON beautifier turns minified JSON, which is all on one line, into clean and indented JSON that is easy for people to read. It is also called a JSON pretty printer.

What is the difference between beautify and minify?

Beautifying adds line breaks and indentation so JSON is readable. Minifying removes them so JSON is as small as possible. Both keep the data the same. Use Compact to one line in the output's ⋯ menu, or the JSON Minifier, to go back to one line.

Can I sort the keys while beautifying?

Yes. Choose Sort keys from the editor's ⋯ menu to order keys alphabetically. Sorted keys make two versions of a file easier to compare.

Why will my JSON not beautify?

The input has a syntax error, such as a trailing comma, a single-quoted string or a missing bracket. The status line shows the line and column. When the mistake can be fixed automatically, a Fix JSON button appears next to it, and Ctrl+Z undoes the fix.

Is the beautified JSON safe to use in production?

Yes. Beautifying only changes whitespace, so the result is valid JSON with exactly the same data. Servers often minify it again before sending it, to save bandwidth.

Download JSON

Save to this browser

Saves both the input and the output. Stored only in this browser on this device; use Export in Saved to back it up.

Share

Anyone with the link can see this JSON. Leave out passwords, tokens and personal data.

Shares the input and the output together.

Editor settings

Type

{
  "id": 1024, "name": "Ada", "active": true,
  "tags": ["0O", "1lI", "=> != >="], "manager": null
}

Colour theme

Code editor

Defaults

Saved JSON

    Nothing saved yet

    Press Ctrl+S or use Save on the toolbar to keep JSON here. It stays in this browser and is never uploaded.

    Stored in this browser only, not in an account. Saved JSON and links are lost if you clear your browsing data, use a private window, switch browser or device, or the browser frees up space. Use Export all now and then to keep a copy.

    Send feedback

    How is online-json working for you?