JSON Formatter & Prettifier

Format, minify and validate JSON as you type.

Paste JSON, upload a file or load a URL. Pasted text and files stay in your browser.

The formatted JSON appears here as you type.

What Is a JSON Formatter?

A JSON formatter, also called a JSON prettifier or beautifier, adds line breaks and indentation to JSON so people can read it. API responses and log entries usually arrive as one long line, which makes nesting and missing values hard to see. Formatting changes only the whitespace between values, so the data stays the same.

The tool also works the other way. Minified removes all the extra whitespace, which makes the JSON smaller to send or store.

Pasted text and uploaded files are processed in your browser and are not uploaded to Geekflare servers. If you load a URL, your browser requests it directly from that site.

How to Use It

  1. Paste JSON on the left, upload a file, or enter a URL under Load from URL.
  2. The formatted JSON appears on the right as you type. The line under it confirms the JSON is valid.
  3. Choose the Indentation, or pick Minified (one line).
  4. Turn on Sort keys A to Z if you want to compare two documents or keep keys in a set order.
  5. Copy the result or download it.

Before and After

Minified input:

json
{"id":1001,"active":true,"roles":["admin","editor"],"profile":{"email":"alex@example.com"}}

Formatted with 2 spaces:

json
{
  "id": 1001,
  "active": true,
  "roles": [
    "admin",
    "editor"
  ],
  "profile": {
    "email": "alex@example.com"
  }
}

Your Values Stay as Written

Many formatters parse the JSON into JavaScript and print it again, which can change the data. This one reprints each value from your original text:

InputHereAfter JavaScript's JSON.parse
123456789012345678901234567890123456789012345678901234567000
1250.501250.501250.5
1e31e31000
"é""é""é"
{"a":1,"a":2}Both keys, with a warning{"a":2}

Sorting keys changes their order, but each value stays the same. Array items are never reordered, since their order is part of the data.

Fixing Common JSON Errors

When the JSON is invalid, the output shows the first error with its line and column, and marks the position. Fix it, and the next error appears if there is one.

ProblemInvalidValid
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
Unquoted key{a: 1}{"a": 1}
Comment{"a": 1 // note}{"a": 1}
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}
Python or JavaScript values{"a": None, "b": undefined}{"a": null, "b": null}

Single Quotes

The Single quotes option helps when you paste JSON into code, such as a JavaScript or Python string. Single-quoted output isn't valid JSON, so JSON parsers will reject it, and the tool downloads it as a .txt file.

Related Tools

Frequently Asked Questions

No. Pasted text and uploaded files are processed in your browser. If you use Load from URL, your browser requests that URL directly from the site, not through Geekflare.

No. Only the whitespace changes, unless you sort keys or switch to single quotes. Numbers such as 1250.50 and very large integers stay exactly as you wrote them.

Prettifying adds line breaks and indentation so people can read the JSON. Minifying removes that whitespace so the JSON is smaller to send or store. Both hold the same data.

Yes, it checks syntax as you type and shows the first error with its line and column. To check that values and structure follow a set of rules, use the JSON Schema Validator.

The site may block requests from browsers with CORS rules, or the URL may require a login. In that case, open the URL yourself and paste the JSON or upload it as a file.

More Utilities & Converters tools
500 free credits a month, no card

Building your own app? Try the Geekflare API.

One API key for scraping, search, screenshots, DNS, PDF, and more.

bash
curl -X POST https://api.geekflare.com/webscraping \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'