Skip to content
so-yi tools

JSON Formatter & Validator

Format, minify, and validate JSON with precise error locations.

Everything runs in your browser. Nothing is sent to a server.

Nothing leaves your browser

This tool parses JSON entirely in your browser. No network request is made, so you can safely paste API responses or config files that contain tokens and personal data.

Common JSON syntax mistakes

JSON looks like a JavaScript object literal but is far stricter. Plenty of syntax that works in JavaScript is an error in JSON.

Trailing commas are not allowed

{
  "a": 1,
  "b": 2,   ← this comma is an error
}

JavaScript object literals allow a trailing comma — it even keeps diffs clean, so many style guides encourage it. But RFC 8259 forbids it in JSON.

Only double quotes

{ 'name': 'value' }   ← error
{ "name": "value" }   ← valid

Both keys and string values require double quotes. Unquoted keys are an error too.

Comments are not allowed

Neither // nor /* */ is valid JSON. If you need comments in a config file, use a "_comment" key, or switch to JSON5 or YAML.

Files like VS Code's settings.json are not really JSON — they use a separate format called JSONC.

Other things JSON rejects

  • undefined (only null exists)
  • NaN and Infinity
  • Functions and regular expressions
  • A leading + or leading zeros (01)
  • Hexadecimal literals (0xFF)

Large numbers lose precision

JavaScript numbers are IEEE-754 doubles. Integers are exact only up to ±(2^53 − 1), roughly 9 quadrillion.

{ "id": 9007199254740993 }
→ parses as 9007199254740992

Twitter snowflake IDs, 64-bit primary keys, and some payment transaction IDs exceed that range. The standard fix is to send such values as strings in your API.

This tool uses the browser's JSON parser, so it has the same limitation. If a large ID came back subtly different, this is why.

Reading the error location

When parsing fails, the tool reports the line and column where the parser gave up.

Keep in mind that the reported position is often after the real cause. If you forget a comma at the end of line 3, the parser only notices something is wrong once it reaches line 4. Start checking from the line before the reported one.

When to sort keys

"Sort keys" recursively reorders object keys alphabetically. It is most useful when comparing two JSON documents.

Two files with identical content but different key order show up as completely different in a diff tool. Sort both first and only the real changes remain.

Array order carries meaning, so arrays are left untouched.

How much does minifying help?

Minifying strips all whitespace and newlines. Heavily indented files shrink by 30–50%.

In a real web service the gain is smaller than it looks, because the server already compresses responses with gzip or brotli, and those algorithms handle repeated whitespace extremely well.

Minifying clearly pays off when you need to fit JSON into a length-limited place — an environment variable or a URL.

Related tools

To encode JSON as Base64, see the Base64 encoder and decoder. To inspect a token payload, use the JWT decoder.

Frequently asked questions

Last updated August 27, 2026