ToolNest
100% Free

Prettify JSON

Format JSON with proper indentation and spacing.

Input JSON

// {
// "name": "John",
// "age": 30,
// "city": "New York"
// }

Prettified JSON

// Paste or type your code here
// e.g. { "key": "value" }

Tool options

Indentation

Use Spaces

Indent output with spaces

Use Tabs

Indent output with tabs.

Prettify JSON

Raw JSON copied from logs, API responses or database dumps usually arrives as a single unbroken line, and finding the one value you need in thousands of characters is slow going. This formatter takes that compressed JSON and rebuilds it with consistent indentation, one property per line, so the structure becomes visible at a glance. Nested objects and arrays are indented level by level, which makes it much easier to see where a payload begins, ends and repeats.

You can choose how the output is indented: two or four spaces, or a tab character per level. Two spaces is the de facto standard for web projects and keeps deeply nested documents narrow; tabs survive round trips through editors that disagree about space counts. Paste your JSON into the input area and the formatted result appears immediately, so you can switch the indentation setting and compare outputs while you type.

A detail worth knowing: the formatter parses your input before printing it, which means it doubles as a quick sanity check. If the JSON is malformed you get a parse error pointing at the problem instead of a half-formatted document. What it will not do is change your data — key order, string values and number precision are preserved exactly as they were.

Formatting happens entirely in your browser. The JSON never leaves your machine, which matters when you are working with payloads that contain user data, tokens or anything else you would rather not paste into a web service. Large documents format instantly; for multi-megabyte inputs give the tab a moment to process.


Prettify JSON Examples

Click to try!

Beautify an Ugly JSON Array

In this example, we prettify an ugly JSON array. The input data is a one-dimensional array of numbers [1,2,3] but they are all over the place. This array gets cleaned up and transformed into a more readable format where each element is on a new line with an appropriate indentation using four spaces.

Indentation

Use Spaces

Indent output with spaces

Use Tabs

Indent output with tabs.

Prettify a Complex JSON Object

In this example, we prettify a complex JSON data structure consisting of arrays and objects. The input data is a minified JSON object with multiple data structure depth levels. To make it neat and readable, we add two spaces for indentation to each depth level, making the JSON structure clear and easy to understand.

Indentation

Use Spaces

Indent output with spaces

Use Tabs

Indent output with tabs.

Beautify a JSON with Excessive Whitespace

In this example, we show how the JSON prettify tool can handle code with excessive whitespace. The input file has many leading and trailing spaces as well as spaces within the objects. The excessive whitespace makes the file bulky and hard to read and leads to a bad impression of the programmer who wrote it. The program removes all these unnecessary spaces and creates a proper data hierarchy that's easy to work with by adding indentation via tabs.

Indentation

Use Spaces

Indent output with spaces

Use Tabs

Indent output with tabs.


All JSON Tools

Validate JSON

Validate JSON code for errors

Minify JSON

Minify JSON by removing whitespace

JSON to CSV

Convert JSON to CSV format

Compare JSON

Find differences between two JSON objects

You May Also Like

Resize Image

Resize one or multiple images at once.

Compress Images

Compress one or multiple images at once.

Split PDF

Extract specific pages from a PDF file

Rotate PDF

Rotate pages in a PDF document

Remove duplicate lines

Quickly delete all repeated lines from text

Base64 Encoder/Decoder

Encode or decode data using Base64.

We use cookies

We use cookies for analytics and advertising. You choose what's enabled. Essential cookies are always on. Privacy Policy