JSON Formatter & Validator

Pretty-print or minify JSON and see the exact line of any error.

Result

{
  "name": "Superwebkit",
  "tools": [
    {
      "id": 1,
      "free": true
    },
    {
      "id": 2,
      "free": true
    }
  ],
  "private": true,
  "price": 0
}
15 lines · 171 bytes
  • Valid JSON: 11 values, 8 keys, 4 levels deep, 99 bytes.

What does a JSON formatter do?

JSON is a plain text format for data that web APIs, config files and apps use all the time. Machines do not care about spaces, so JSON often arrives as one long line that is hard for a person to read.

A formatter adds line breaks and indentation so the structure is visible, and it checks the text follows the JSON rules. The sample object in this tool is 99 bytes on one line and turns into a clean 4-level tree when formatted. If the text is invalid, you get the line and column of the first problem.

How to use the JSON Formatter & Validator

  1. Paste your JSON on the left.
  2. Choose the indent: 2 spaces, 4 spaces or tab.
  3. Choose whether to keep the key order or sort A to Z.
  4. Copy or download the formatted result, or read the error and fix the spot it points to.

Real situations

When people use the JSON Formatter & Validator

  • 1

    Read an API response

    Paste a one-line response from a network panel or a curl call and see nested objects and arrays laid out clearly.

  • 2

    Find a syntax error fast

    A missing bracket or trailing comma can break an app. The error names the line and column and shows a caret under the spot.

  • 3

    Tidy config before a commit

    Re-indent a config file with 2 spaces, 4 spaces or tabs and sort the keys A to Z, so changes show up cleanly in review.

  • 4

    Keep long IDs exact

    Numbers are kept as written, so a 20-digit ID is not rounded, which many formatters silently do.

Good to know

  • JSON allows only double quotes, no comments and no trailing commas.
  • Sorting keys changes order only, not meaning, but some tools depend on key order.
  • To shrink JSON instead, use the minifier.

FAQ

JSON Formatter & Validator: questions answered

Why does my JSON say it is invalid?

Common causes are a trailing comma, single quotes instead of double quotes, keys without quotes, comments and a missing closing bracket. For example {"a":1,} reports a comma before the closing brace at line 1, column 7.

Does formatting change my data?

No. Only whitespace changes. A number like 12345678901234567890 stays exactly as written, with the tool noting it is too precise for JavaScript, and 1.10 stays 1.10. Parsing and re-printing in JavaScript would round the first and turn the second into 1.1.

What is the difference between formatting and validating?

Validating checks that the text follows the JSON rules. Formatting rearranges whitespace for readability. This tool does both, so a formatted result also means the JSON is valid.

What does sort keys do?

It reorders the keys inside every object from A to Z. For {"b":1,"a":2} you get "a" first, then "b". Arrays keep their order. Choose keep order if the order carries meaning for you.

Can I use single quotes or comments in JSON?

Not in standard JSON. Keys and strings need double quotes and there is no comment syntax. The tool follows the strict rules, so single quotes produce an error that points at the spot.

Does the formatter handle big files?

It runs in your browser, so very large files depend on your device's memory. For a typical API response or config file the result appears immediately, and the notes show the number of values, keys, depth and bytes.

Is this JSON Formatter & Validator free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way