JSON Formatter

Paste JSON to validate, pretty-print, or minify it — with clear error locations.

Paste JSON

What this checks & how to read the result

It runs your input through a strict JSON parser — the same rules any API or config file that expects real JSON will enforce — and reports either the formatted result or exactly where parsing failed. Nothing here is JavaScript-flavored leniency; if it's not valid JSON, it's flagged. Formatting happens as you type, entirely in your browser.

Format vs. Minify

Format re-indents the data with two spaces per level and one key per line, which is the easiest shape to read, review in a diff, or edit by hand. Minify removes every space and line break that JSON doesn't need, producing the smallest valid version for an API payload, a config value or an inline <script>. Both produce the same data; only the whitespace changes.

The rules that most often break JSON

InvalidValidWhy
{"a": 1,}{"a": 1}No trailing comma after the last item
{'a': 'x'}{"a": "x"}Strings and keys need double quotes
{a: 1}{"a": 1}Keys must be quoted strings
{"a": 1 // note}{"a": 1}JSON has no comments
{"a": NaN}, undefined{"a": null}Only numbers, strings, true, false, null, objects and arrays
{"a": 07}{"a": 7}No leading zeros on numbers

How to read the result

When the input is valid, the header shows the total number of keys, counted through every nested object — a quick way to confirm a large payload contains what you expect. When it's invalid, you get the parser's own error message. When that message includes a character position, the tool converts it into a line and column so you can jump straight to the problem in your editor. The real mistake is often just before that point, such as a missing comma on the previous line.

Things formatting changes that you might not expect

  • Duplicate keys. If an object has the same key twice, the parser keeps the last value and the formatted output contains it only once. The JSON standard only says keys should be unique, and most parsers behave this way, so the earlier value is silently lost.
  • Very large numbers. Numbers are read as standard double-precision values, so integers above 9,007,199,254,740,991 (for example 64-bit IDs) can come out rounded. Store such IDs as strings.
  • Escapes. Escaped characters such as \u00e9 are decoded and written back as the character itself (é). The data is identical; only its spelling in the file changes.

Checking structured data

JSON-LD structured data is JSON, so a page's schema markup fails here for the same reasons: paste the contents of its <script type="application/ld+json"> block to find syntax errors. To check every JSON-LD block on a live page at once — whether each one parses and declares a @type — use the Schema Markup Validator.

Frequently asked questions

Does my JSON get sent anywhere?

No — parsing and formatting both happen entirely in your browser. Nothing you paste here is sent to a server.

What's the difference between Format and Minify?

Format pretty-prints with 2-space indentation, for reading or editing. Minify strips all unnecessary whitespace down to the smallest valid representation, for shipping over the wire or embedding in code.

Why does it show a line and column number for errors?

JSON.parse only reports a raw character position by default, which is hard to act on in a large file. This tool converts that position into a line and column so you can jump straight to the actual problem in your editor.

It says invalid, but the JSON looks fine to me — what's a common cause?

The most frequent culprits are a trailing comma after the last item in an object or array (valid in JavaScript object literals, but not in strict JSON), single quotes instead of double quotes around strings and keys, or an unquoted key name.

Related tools

We use cookies to analyze site usage and improve your experience. You can decline non-essential cookies. Privacy Policy