JSON Formatter & Validator

Paste JSON to check that it is valid and make it readable. The formatter indents nested objects and arrays, can sort keys alphabetically, or minifies JSON to a single line for requests and config files. If something is wrong, it shows the line, column and a short explanation. Your JSON stays on your device.

Runs in your browser ยท Your JSON is never uploaded

Loading the tool…

Tip: the output updates as you type. Press Ctrl + Enter (Cmd + Enter on a Mac) to format large inputs.

How to use the JSON Formatter & Validator

  1. Paste JSON into the input, or open a .json file.
  2. Choose Format or Minify, the indentation, and whether to sort keys.
  3. The result updates as you type. Very large inputs wait for the Format button (or Ctrl + Enter).
  4. If the JSON is invalid, read the error and the marked line, fix it, and the output appears again.
  5. Copy the result or save it as a .json file.

What the formatter changes

Only whitespace (and key order if you ask)
Numbers and strings are copied exactly as written. Large integers such as 9007199254740993 and long decimals are not rounded, and escape sequences like \u00e9 stay as they are.
Sorting keys
Sort keys orders object keys alphabetically by their decoded text, at every level. Arrays keep their order, because array order is part of the data.
Strict JSON
Comments, trailing commas, single quotes, unquoted keys, NaN and undefined are reported as errors, because standard JSON parsers reject them.
Duplicate keys
If an object repeats a key, both entries are kept in the output and a warning names the key. Most parsers silently keep only the last value, which can hide bugs.

Examples

These outputs were produced by the same code that runs in the tool above.

Format a compact API response

A one-line order response formatted with 2-space indentation. Note that 19.90 and the large ID keep their exact digits.

Input JSON

{"order_id":9007199254740993,"status":"paid","total":19.90,"items":[{"sku":"ZV-1001","qty":2},{"sku":"ZV-1002","qty":1}],"note":null,"tags":[]}

Output

{
  "order_id": 9007199254740993,
  "status": "paid",
  "total": 19.90,
  "items": [
    {
      "sku": "ZV-1001",
      "qty": 2
    },
    {
      "sku": "ZV-1002",
      "qty": 1
    }
  ],
  "note": null,
  "tags": []
}

Minify with sorted keys

A formatted config file minified to one line, with keys sorted so two versions are easy to compare.

Input JSON

{
  "timeout": 30,
  "retries": 3,
  "endpoints": {
    "orders": "/v2/orders",
    "auth": "/v2/auth"
  },
  "debug": false
}

Output

{"debug":false,"endpoints":{"auth":"/v2/auth","orders":"/v2/orders"},"retries":3,"timeout":30}

Frequently asked questions

Is my JSON sent to a server?

No. Validation and formatting run on your device. Nothing you paste is uploaded, logged or stored.

Why does it say my JSON is invalid when my code accepts it?

Some tools accept relaxed formats such as JSON5, JavaScript objects or JSON with comments. This validator follows the JSON standard (RFC 8259), which is what APIs and most parsers expect.

Can it format very large files?

Yes, up to 20 MB. Inputs over 200,000 characters are formatted when you select Format instead of on every keystroke.

Does minifying change my data?

No. Minifying only removes whitespace between values. Whitespace inside strings is kept.

Limitations and edge cases

  • Only standard JSON is accepted; JSON5, comments and trailing commas are reported as errors.
  • JSON nested more than 512 levels deep is rejected.
  • The editor can become slow with inputs of several megabytes.

Read the privacy policy for how the site handles data.