Skip to content

Pretty Print JSON

Pretty-printing is the fastest way to read a one-line API response. This page targets that query with Pretty print highlighted — your JSON never leaves the tab.

Loading tool…

How to use Pretty Print JSON

  1. 1. Paste minified JSON. Or drop a .json file from logs or curl output.
  2. 2. Pretty print. Pick indentation, then copy from the formatted pane.
  3. 3. Explore structure. Open Tree view for nested objects without scrolling a wall of text.

About this tool

“Pretty print json” and “format json online” are the same practical task: make machine JSON human-readable. This alias exists so the title and H1 match that query instead of a generic tool name.

Pretty print in your editor vs online

IDE formatters are great for files already in git. An online pretty-printer helps when the payload is in a ticket, a chat message, or a production log you cannot save to disk.

Code examples

JavaScript

const payload = JSON.parse(raw);
console.log(JSON.stringify(payload, null, 2));

Python

import json
print(json.dumps(json.loads(raw), indent=2, sort_keys=True))

Go

var buf bytes.Buffer
if err := json.Indent(&buf, []byte(raw), "", "  "); err != nil {
  log.Fatal(err)
}

This page is a preset of JSON Formatter — the same editor, opened for this specific use. Every feature is available here.

Frequently asked questions

Go deeper

Longer reads on the concepts behind this tool.

Related tools

All tools