Skip to content

JSON formatter and validator

Paste JSON to pretty-print it, minify it or check that it is valid. Errors are pinned to the exact line and column, with a hint about what went wrong.

  • Free, no limits
  • No sign-up
Everything happens in your browser; your data is never uploaded.
  • ✓ Free
  • ✓ No sign-up
  • ✓ Nothing uploaded

Next step

What to do next

How to use it

  1. Paste your JSON into the box.
  2. Pick 2 spaces, 4 spaces or tabs, and optionally sort keys.
  3. Click Format, Minify or Validate only.
  4. Copy the result or download it as a .json file.
Try it now

What the tool does

  • Format (beautify): re-indents JSON with 2 spaces, 4 spaces or tabs so nested objects are easy to read.
  • Minify: strips all whitespace to make the smallest valid JSON for APIs and config files.
  • Validate only: checks the syntax without changing anything.
  • Sort keys alphabetically: sorts object keys at every level, which makes two JSON files much easier to compare.
  • Escape / Unescape: turns text into a JSON string literal (with \n, \" and so on) or back again, handy when JSON is embedded inside another JSON string.

Everything runs in your browser, so API responses, logs and config files with private data stay on your computer.

JSON syntax in 60 seconds

JSON (JavaScript Object Notation) has only six kinds of values:

  • objects in curly braces: {"name": "Ada", "age": 36}, with keys that must be double-quoted strings,
  • arrays in square brackets: [1, 2, 3],
  • strings in double quotes, with escapes like \n, \t, \" and \u00e9,
  • numbers such as 42, -3.5 or 1e6 (no leading zeros, no NaN or Infinity),
  • true and false, in lowercase,
  • null.

Whitespace between tokens is ignored, which is why formatting and minifying never change the data. The order of keys inside an object carries no meaning, but the order of items in an array does.

Understanding JSON errors

When the JSON is invalid, the tool shows the line and column of the first error, the line itself with a caret under the problem, and a hint in plain English. The most common causes:

ErrorExampleFix
Trailing comma{"a": 1,}Remove the comma before } or ]
Single quotes{'a': 1}Use double quotes: {"a": 1}
Unquoted key{a: 1}Quote the key: {"a": 1}
Comment// noteStandard JSON has no comments; delete them
Missing bracket{"a": [1, 2}Close every [ with ] and every { with }

JavaScript object literals and JSON5 allow several of these; strict JSON (RFC 8259) does not, and most parsers will reject them.

Large numbers and precision

JSON itself allows numbers of any length, but JavaScript stores numbers as 64-bit floating point. Integers longer than about 15–16 digits (above 2^53, or 9,007,199,254,740,991) can lose precision when parsed, so an ID like 12345678901234567890 may come out slightly different after formatting.

The tool warns you when your JSON contains such numbers. The safe fix is to store long IDs as strings: "id": "12345678901234567890". Many APIs, including large social and payment platforms, do exactly that for this reason.

Formatted vs. minified: when to use which

  • Use formatted JSON for anything people read: config files in a repo, documentation, debugging an API response, code reviews.
  • Use minified JSON for anything machines exchange: API requests and responses, data stored in a database field, values in environment variables. It is smaller and faster to transfer.
  • Turn on sorted keys before you compare two versions of a JSON file in a diff tool. The order of keys has no meaning in JSON objects, so sorting removes noise.

Need to move the data into a spreadsheet? Use the JSON to CSV converter. Working with YAML configs? Try YAML to JSON.

Frequently asked questions

How do I format JSON?

Paste it into the box and click Format. Choose 2 spaces, 4 spaces or tabs for the indentation.

How do I find what is wrong with my JSON?

Click Validate only. If there is an error, you get the line and column, the line with a caret under the problem, and a hint such as trailing comma or single quotes.

Does JSON allow comments or trailing commas?

No. Standard JSON allows neither. Remove comments and the last comma before a closing bracket.

Why did a long number change after formatting?

JavaScript can only represent integers exactly up to 2^53. Store longer IDs as strings in quotes to keep every digit.

Is my JSON sent to a server?

No. Formatting and validation happen entirely in your browser.

Last updated: November 12, 2026

Recommended

Similar tools

If JSON formatter and validator helped, you may need these too.

See all in category →

People also use