JSON Pretty Print - Format & Beautify JSON Online (Free)

Pretty print JSON in one click. Paste minified or messy JSON and get clean, indented output instantly. Free, runs in your browser, nothing uploaded.

Tool options

Output

Indentation

Options

Saved documents

Saved JSON stays in this browser - nothing is uploaded.

Paste JSON - it formats as you type.
Input
Output

Paste messy JSON, get clean and readable output instantly

Drop any compressed or hard-to-read JSON into the box above and hit Format. The tool indents every key-value pair with 2 spaces, adds line breaks, and outputs something your eyes can actually follow - all in your browser, with nothing sent to any server.

How to pretty print JSON online

  1. Paste your raw JSON into the input box.
  2. Choose your indent size (2 spaces is the default; 4 is also common).
  3. Click Format (or Pretty Print).
  4. Copy the output or download it as a .json file.

If your JSON has a syntax error, the tool highlights the problem line and shows the exact error message so you can fix it fast.

JSON pretty print example

Here is a single-line minified JSON string:

{"user":{"id":42,"name":"Alice","roles":["admin","editor"],"active":true}}

After pretty printing with 2-space indentation, the same data looks like this:

{
  "user": {
    "id": 42,
    "name": "Alice",
    "roles": [
      "admin",
      "editor"
    ],
    "active": true
  }
}

Every nested object or array gets its own level of indentation. The data itself is unchanged - only the whitespace and line breaks are added.

How to pretty print JSON in code

If you need to do this inside a script rather than a browser, here are the standard one-liners:

Python

import json

raw = '{"user":{"id":42,"name":"Alice"}}'
data = json.loads(raw)
print(json.dumps(data, indent=2))

json.dumps() with indent=2 is the Python standard-library way to get pretty-printed output. Change 2 to 4 for wider indentation.

JavaScript / Node.js

const raw = '{"user":{"id":42,"name":"Alice"}}'
const data = JSON.parse(raw)
console.log(JSON.stringify(data, null, 2))

The third argument to JSON.stringify() sets the indent level. null in the second position means "include all keys". This works in any modern browser console as well as Node.js.

Command line (jq)

echo '{"user":{"id":42}}' | jq .

jq pretty prints JSON by default when you pass . as the filter. It also colorizes the output in terminals that support it.

How it works

The formatter parses your input into a data tree (just like a browser does with JSON), then serializes it back out with configurable whitespace added at each nesting level. This process follows the JSON specification, so key order is preserved exactly as you wrote it.

Because everything runs in your browser using JavaScript, your data never leaves your device. No upload, no server, no logs.

When to use pretty print - and when not to

SituationPretty print?Why
Reading an API response✅ YesEasier to spot the keys you need
Debugging a config file✅ YesErrors are obvious at a glance
Checking a data type or value✅ YesNo squinting at a single line
Sending JSON in a network request❌ NoExtra whitespace adds unnecessary bytes
Storing JSON in a database column❌ NoCompact form saves space
JSON inside another format (HTML, CSV)❌ NoLine breaks break the surrounding format

When you need the opposite - stripping all whitespace to shrink a payload - try the JSON Minifier. For a full-featured view with collapsible tree nodes, see the JSON Viewer.

Related tools you might need

Bottom line: pretty printing turns unreadable JSON into something you can scan and understand in seconds. Paste your JSON above and see it formatted right now.

Frequently asked questions

Is my JSON data uploaded to a server?+
No. Everything runs directly in your browser. Your JSON is never sent to any server, stored, or logged anywhere. It is safe to paste API keys, tokens, or private config data.
What is the difference between pretty print and beautify?+
They mean the same thing. 'Pretty print' and 'beautify' both describe adding indentation and line breaks to make JSON human-readable. Some tools also call it 'formatting' or 'indenting'. The output is identical.
How do I pretty print JSON in Python?+
Use the built-in json module: json.dumps(data, indent=2). Set indent to 2 or 4 depending on your preference. No extra libraries needed.
How do I pretty print JSON in JavaScript?+
JSON.stringify(data, null, 2) returns a formatted string with 2-space indentation. This works in Node.js and in any modern browser console.
Can I change the indentation from 2 spaces to 4 spaces (or tabs)?+
Yes. Use the indent selector in the tool to choose 2 spaces, 4 spaces, or a tab character before clicking Format. In Python, pass the number you want to the indent argument. In JavaScript, pass it as the third argument to JSON.stringify.
Is this tool free? Do I need to sign up?+
It is completely free and requires no account or sign-up. Just paste and format.
Can it handle large JSON files?+
Yes, for typical files up to a few megabytes this tool handles them quickly. Very large files (tens of MB) may be slower because processing happens in the browser. For extremely large datasets, a command-line tool like jq is faster.
My JSON is showing an error. What does 'Unexpected token' mean?+
'Unexpected token' means the parser found a character it did not expect at that position - usually a missing comma, an extra bracket, or a key without quotes. The error message includes the line and column number so you can jump straight to the problem.