Pretty Print JSON Online: Format and Beautify JSON Instantly

Pretty printing JSON adds indentation and line breaks to a compact JSON string, making it readable at a glance. Paste any minified or unformatted JSON into an online formatter and get a clean, indented result in one click — no code required.

Paste your JSON into Jsonic's JSON Formatter for instant pretty printing with syntax highlighting and tree view.

Pretty print JSON now

What pretty printing does

A minified JSON string packs all data onto one line with no whitespace. Pretty printing expands it so each key-value pair sits on its own line, nested objects are indented, and the structure becomes immediately readable.

// Minified — hard to read
{"user":{"name":"Alice","role":"admin","tags":["api","internal"]},"active":true}

// Pretty printed — 2-space indent
{
  "user": {
    "name": "Alice",
    "role": "admin",
    "tags": [
      "api",
      "internal"
    ]
  },
  "active": true
}

The data is identical. Only whitespace changes. JSON parsers treat both forms exactly the same.

How to pretty print JSON online

  1. Open Jsonic's JSON Formatter.
  2. Paste your JSON string into the left panel — or upload a .json file.
  3. Click Format. The right panel shows the pretty-printed result with 2-space indentation.
  4. Click Copy to copy the formatted JSON, or Download to save it as a file.

The formatter also validates syntax as it formats. If your JSON has an error — a trailing comma, missing bracket, or wrong quote style — it shows the exact line and character before formatting.

Indent size options

The JSON specification accepts any whitespace between tokens. The common conventions are:

IndentTypical use
2 spacesJavaScript, web APIs, most linters
4 spacesPython json.dumps default, Java
TabSome config files, Go json.MarshalIndent

2 spaces is the safest default for any JSON that will be committed to a repository or shared in documentation.

Pretty print JSON in JavaScript

Use JSON.stringify with a space argument to pretty print in code:

const data = { user: { name: 'Alice', role: 'admin' }, active: true }

// 2-space indent
console.log(JSON.stringify(data, null, 2))

// 4-space indent
console.log(JSON.stringify(data, null, 4))

// Tab indent
console.log(JSON.stringify(data, null, '\t'))

See the pretty print JSON in JavaScript guide for replacer functions, custom serialisers, and browser DevTools shortcuts.

Pretty print JSON in Python

import json

data = {"user": {"name": "Alice", "role": "admin"}, "active": True}

# Pretty print to console
print(json.dumps(data, indent=2))

# Pretty print a JSON file
with open("data.json") as f:
    parsed = json.load(f)
print(json.dumps(parsed, indent=2))

# Sort keys alphabetically while formatting
print(json.dumps(data, indent=2, sort_keys=True))

Python's json.tool module also works directly from the terminal — see the format JSON in Python guide for the full command.

Pretty print JSON from a cURL response

Pipe a cURL response through python3 -m json.tool or jq to pretty print API responses in the terminal:

# Using Python (available on most systems)
curl -s https://api.example.com/users | python3 -m json.tool

# Using jq (install separately)
curl -s https://api.example.com/users | jq '.'

Frequently asked questions

What does pretty print JSON mean?

Pretty printing adds indentation and line breaks so each key-value pair is on its own line and nested objects are visually indented. The data is identical — only the whitespace changes.

Is pretty-printed JSON valid JSON?

Yes. JSON parsers ignore whitespace outside string values, so a pretty-printed file and a minified file are semantically identical and interchangeable.

What is the difference between pretty print and beautify?

They mean the same thing. "Beautify", "pretty print", and "format" all refer to adding indentation and whitespace to make JSON human-readable. Some tools also call this "format" or "indent".

Does pretty printing change the JSON data?

No. Only whitespace outside of string values is added. The keys, values, types, and structure are unchanged. Parsing a pretty-printed file produces the exact same object as parsing the minified original.

Format your JSON in one step

Paste any JSON string — minified, malformed, or deeply nested — into Jsonic's JSON Formatter. It pretty prints, validates, and lets you explore the structure in a tree view.

Open JSON Formatter