SmartQueryTools

JSON Beautifier

Paste minified JSON or upload a file to format it with proper indentation. Runs entirely in your browser — nothing is uploaded.

Indent:

Input

Formatted output

How to use the JSON Beautifier

  1. Paste JSON into the Input box, or click Upload JSON file and choose a .json file.
  2. Pick the indentation: 2 spaces (the default) or 4 spaces. You can switch at any time and the output updates.
  3. Read the formatted JSON in the output box. It updates as you type.
  4. If the input is not valid JSON, an error message shows what the parser found and where.
  5. Click Copy to copy the result, or Download to save it as formatted.json.

Worked example

An API returns an order as a single line of JSON. Formatting it makes the nested items array easy to read.

Input (one line)

{"order":1042,"items":[{"sku":"A-1","qty":2},{"sku":"B-7","qty":1}],"paid":true,"note":null}

Settings

  • Indent: 2 spaces

Formatted output

{
  "order": 1042,
  "items": [
    {
      "sku": "A-1",
      "qty": 2
    },
    {
      "sku": "B-7",
      "qty": 1
    }
  ],
  "paid": true,
  "note": null
}

Each key goes on its own line. Every level of nesting adds two more spaces. Arrays of objects are expanded so each object gets its own block. Values such as true and null are unchanged.

Reading formatted JSON

Formatted JSON shows structure through indentation. Curly braces hold objects, which are sets of key and value pairs. Square brackets hold arrays, which are ordered lists. Each extra indent means you are one level deeper.

This makes it quick to answer common questions about an API response. How many items came back? Which field is null? Is the value a number or a string in quotes? In the example above, qty is a number and sku is a string.

If you want to work with the records rather than read them, the JSON Viewer shows an array of objects as rows and columns, and JSON to CSV turns it into a file you can open in a spreadsheet.

Frequently Asked Questions

What is the difference between beautifying and minifying JSON?

Beautifying adds line breaks and indentation so people can read the JSON. Minifying removes them so the file is as small as possible. Both keep the same data. Use the JSON Minifier to go the other way.

Should I use 2 or 4 spaces?

Two spaces is the most common choice for JSON and keeps deep nesting from drifting too far right. Four spaces is easier to scan for some people and matches some style guides. Pick whatever your project already uses.

Can this tool fix broken JSON?

No. It formats valid JSON and reports errors in invalid JSON. The error message from the parser usually points to the position of the problem, such as a trailing comma, a missing quote or a single-quoted string.

Can I use tabs instead of spaces?

Not in this tool. The options are 2 spaces or 4 spaces.

Will formatting change my values?

Strings, booleans and null are kept exactly. The JSON is parsed and written back out, so number formats are normalised: 1.50 becomes 1.5, and integers larger than 2^53 lose precision. Keys that look like whole numbers, such as "10", are listed first in their object.

Related tools