JSON Formatter

Format, minify and validate JSON with exact error locations.

  • Runs in your browser
  • Free, no sign-up
Output

    
Paste JSON to startCtrl Enter format · Ctrl Shift M minify

About the JSON Formatter

JSON from an API, a log file or a config export often arrives as one long line that is hard to read. Paste it into the JSON Formatter and it comes back neatly indented, one value per line, with keys, strings and numbers in different colors.

The formatter also checks the syntax as you type. If something is wrong, such as a trailing comma, a single quote or a missing bracket, it tells you what the problem is and where it is, down to the line and column. Click the message and the cursor jumps right to it.

Unlike many formatters, it never rounds your numbers. Long IDs and values like 1.10 stay exactly as you wrote them. Everything runs in your browser, so the JSON you paste never leaves your device.

How to use it

  1. Add your JSONPaste it into the Input box, drop a .json file onto it, or use Open file. Sample loads an example order to try.
  2. Choose Format or MinifyFormat spreads the JSON over several lines with indentation. Minify removes every space and line break that is not needed.
  3. Pick an indentChoose 2 spaces, 4 spaces or tabs. Turn on Sort keys to put the keys of every object in alphabetical order.
  4. Fix any errorsIf the JSON is not valid, the status line shows the line, the column and the reason. Click it to jump to the spot in the input.
  5. Copy or downloadCopy the result, or download it as formatted.json or minified.json.

Key features

Live validation

The input is checked on every change. The status line says "Valid JSON" and shows the number of keys, the nesting depth, lines and size.

Clear error messages

Messages name the actual problem, such as "Trailing comma", "Comments are not allowed in JSON" or "Property names must use double quotes", with the exact line and column.

Numbers kept as written

Big integers, trailing zeros and exponents are copied exactly, so 90071992547409931 does not turn into 90071992547409940.

Indent and sort options

2 spaces, 4 spaces or tabs, and optional alphabetical key order at every level. Array order is never changed.

Syntax colors

Keys, strings, numbers, true and false, and null each have their own color, so the structure is easy to scan.

Private by design

Your JSON is parsed in your browser. Nothing is uploaded or stored.

Examples

Formatting an API response

The Sample button loads a 261-byte order on a single line:

{"order":{"id":"ord_7Hq2","status":"shipped","placed":"2026-03-14T09:21:05Z","total":{"amount":129.5,"currency":"USD"},"items":[{"sku":"MW-104","qty":2,"price":39.75},{"sku":"MW-311","qty":1,"price":50}],"gift":false,"note":null,"trackingId":90071992547409931}}

Formatted with 2 spaces, it becomes 26 lines. The status line reads Valid JSON with 17 keys · depth 4 · 26 lines · 431 B. The beginning looks like this:

{
  "order": {
    "id": "ord_7Hq2",
    "status": "shipped",
    "placed": "2026-03-14T09:21:05Z",
    "total": {
      "amount": 129.5,
      "currency": "USD"
    },
    ...

The indent changes the size: the same JSON is 431 bytes with 2 spaces, 559 bytes with 4 spaces and 367 bytes with tabs. Minify takes it back to 261 bytes.

Common errors and what the formatter says

You pasteMessage
[1, 2, 3,]Trailing comma: remove the comma before "]"
{'name': 'Ada'}Property names must use double quotes, not single quotes
{name: "Ada"}Property name "name" must be in double quotes
{"zip": 02134}Numbers cannot start with a leading zero
{"score": NaN}NaN is not valid in JSON
{"ok": True}True is not valid in JSON: write true in lowercase
{"a": [1, 2Unexpected end of the text: "]" is missing

Every message starts with its position. For this input, the error is reported as Line 3, column 12, which is the comma after 36:

{
  "name": "Ada",
  "age": 36,
}

Sorting keys

With Sort keys on, this object:

{"name":"Ada Lovelace","born":1815,"languages":["English","French"],"active":false}

comes out with its keys in alphabetical order. The array keeps its order:

{
  "active": false,
  "born": 1815,
  "languages": [
    "English",
    "French"
  ],
  "name": "Ada Lovelace"
}

Numbers stay exactly as written

Most tools read JSON numbers as JavaScript numbers, which only hold about 15 to 17 significant digits. This formatter copies them as text instead. Minify this input:

{"id": 12345678901234567890, "price": 1.10, "rate": 1e-7, "neg": -0}

and every number comes out unchanged:

{"id":12345678901234567890,"price":1.10,"rate":1e-7,"neg":-0}

A formatter that relies on JavaScript's own JSON functions would give this instead, with a rounded ID, a lost zero and a lost minus sign:

{"id":12345678901234567000,"price":1.1,"rate":1e-7,"neg":0}

Tips

  • Use Ctrl Enter to format and Ctrl Shift M to minify (Cmd on a Mac) without reaching for the mouse.
  • Minify JSON before you paste it into an environment variable, a URL parameter or a single-line log field. Format it again whenever you need to read it.
  • Turn on Sort keys before comparing two versions of a file. Objects with the same data then line up in the same order, which makes differences easy to spot.
  • If you copied JSON out of JavaScript or Python code, expect a few errors: comments, single quotes, trailing commas and True, False or None all need fixing. Work through them one message at a time.
  • For large or deeply nested JSON, the JSON Viewer lets you fold sections, search and copy the path to any value.

Common mistakes and limits

  • Expecting comments to be keptStandard JSON has no comments, so // and /* */ are reported as errors. Remove them, or keep notes in a separate field such as "_note".
  • Confusing a JavaScript object with JSONJavaScript allows unquoted keys, single quotes and trailing commas. JSON allows none of them, and the formatter follows the JSON standard.
  • Thinking Sort keys changes the dataSorting only changes the order of keys inside objects, which has no meaning in JSON. It never reorders arrays. Still, if a program depends on key order, leave it off.
  • Pasting more than one valueA file with one JSON object per line (JSON Lines) is several values, not one, so the formatter stops with "Unexpected text after the end of the JSON value".
  • Expecting colors on huge filesSyntax colors are skipped when the output is longer than 200,000 characters, to keep the page fast. The formatted text is the same.

Frequently asked questions

What does a JSON formatter do?
It adds line breaks and indentation so each key and value sits on its own line, nested to show the structure. The data itself does not change, only the whitespace around it.
How do I know if my JSON is valid?
Paste it in. If the status line says "Valid JSON", it follows the JSON standard. Otherwise it shows the first error with its line, column and a plain-language reason.
What is the difference between Format and Minify?
Format makes JSON readable with line breaks and indentation. Minify removes all the extra whitespace to make it as small as possible, which is better for sending and storing.
Should I indent with 2 spaces, 4 spaces or tabs?
Any of them is valid JSON. 2 spaces is the most common choice for web projects and APIs. Tabs give the smallest formatted file. Follow whatever your project already uses.
Why does my JSON fail with single quotes?
The JSON standard only allows double quotes around keys and strings. Replace 'name' with "name" and the error goes away.
Does the formatter change my numbers?
No. Numbers are copied exactly as written, so very long IDs, trailing zeros like 1.10 and exponents like 1e-7 stay the same.
Can I format JSON Lines or several objects at once?
Not in one go. The input must be a single JSON value. Wrap the objects in [ ] and separate them with commas to turn them into one array.
Is there a size limit?
Files up to 10 MB can be opened. When the input is longer than 200,000 characters, the output refreshes a moment after you stop typing, and output of that size is shown without colors.
Is my JSON sent to a server?
No. Formatting and validation run in your browser. Nothing is uploaded, and the JSON is gone when you close the page.