JSON Formatter

Beautify JSON with clean indentation or minify it to a single line. If there is a syntax error, you see the exact line and column right away.

๐Ÿ”’ Files and inputs never leave your device
Paste JSON and it is validated instantly.

  
iPhone app ยท Free to downloadScanner - Scan to PDF, DocsScan paper documents into clean PDFs with your iPhone.View on the App Store

About the JSON Formatter

This JSON formatter turns long one-line JSON, such as API responses or config files, into readable, indented JSON, or strips all whitespace to minify it. It validates as you type and tells you the exact line, column and cause of problems like missing commas or wrong quotes.

The tree view lets you collapse and expand objects and arrays to explore the structure. Everything runs in your browser, so JSON containing company data or personal information is never uploaded to a server.

How to use

  1. Paste JSON into the input box or load a .json file with Open file.
  2. Beautify applies indentation (2 spaces, 4 spaces or tabs); Minify removes all whitespace.
  3. If there is an error, the red message shows the line and column. Click Go to error to select that spot in the input.
  4. Switch to the Tree view to explore the structure, then Copy the result or Download it as a .json file.

Worked examples

Pretty-print a minified API response

Input
{"id":1024,"name":"Jane Doe","tags":["vip","new"],"active":true}
(2-space indent, Pretty)
Result
Status: Valid JSON ยท object ยท 4 keys ยท depth 2 ยท 64 B โ†’ 94 B
Each key gets its own line and the "tags" array is expanded one item per line.

The extra 30 bytes are just indentation and line breaks. Switch to Minify before pasting the payload back into a request body or an environment variable.

Find a trailing comma in a config file

Input
{
  "name": "Jane",
  "age": 30,
}
Result
Line 3, column 12: Trailing comma after the last item is not allowed
The broken line is shown with a ^ marker, and the jump button moves your cursor there.

JavaScript objects and JSONC files (VS Code settings, tsconfig.json) tolerate a trailing comma, but strict JSON parsers such as JSON.parse, Python's json module and most APIs reject it.

Pasting a Python dict instead of JSON

Input
{'ok': True, 'items': None}
Result
Line 1, column 2: Keys must use double quotes ("), not single quotes

print(data) in Python shows single quotes, True and None, which is not JSON. Use print(json.dumps(data)) to get double quotes, true and null.

Common JSON errors

ErrorWrongRight
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
Unquoted key{a: 1}{"a": 1}
Comments// noteNot allowed
Capitalized literalsTrue, Nonetrue, null
Leading zero0077 or "007"

JSON is stricter than JavaScript object syntax. Keys and strings must always use double quotes, and undefined, NaN and functions are not valid values.

JSON data types

A JSON value is one of six types: string ("text"), number (integer, decimal or exponent), boolean (true/false), null, object ({ }) and array ([ ]). There is no date type, so dates are usually stored as ISO 8601 strings such as "2026-10-01T09:00:00Z".

FAQ

Is my JSON sent to a server?

No. Validation and formatting happen entirely in your browser. Only your last input is saved locally in this browser, and the Clear button removes it.

Why do very large numbers change?

JavaScript stores numbers as 64-bit floating point, so integers larger than 9,007,199,254,740,991 (2^53โˆ’1) lose precision. Send big IDs as strings to be safe.

When should I sort keys?

Sorting is handy when comparing two JSON documents or tidying config files. Object keys are sorted alphabetically at every level; the order of array items is never changed.

How large a file can it handle?

Several megabytes work fine. Results over 300,000 characters are shown without syntax highlighting for speed, and the tree view renders nodes only when you expand them.

What about JSON files with comments?

Standard JSON has no comments, so a line starting with // is reported as an error at its exact position. For JSONC files such as tsconfig.json or VS Code settings, remove the comments and any trailing commas first. To embed JSON in a URL or a header, run it through the URL encoder or Base64 afterwards.