Format, validate and minify JSON

Paste JSON and it is formatted as you type. Invalid input shows the error with line and column so you can fix it fast. Switch to minify for compact output, sort keys alphabetically, and copy or download the result. Nothing leaves your browser.

✓ Runs in your browser — nothing uploaded Free, no sign-upNo watermark

How to use the JSON Formatter & Validator

  1. Paste JSON into the input box (or type it).
  2. The output updates automatically; choose 2 spaces, 4 spaces or tabs.
  3. If the JSON is invalid, read the line and column in the output and fix it.
  4. Use Minify for the smallest payload, then Copy or Download.

What counts as valid JSON

JSON is stricter than JavaScript object syntax. Keys must be double-quoted strings, string values must use double quotes, trailing commas are not allowed, comments are not allowed, and the only literals are true, false and null. The most common errors this tool reports are a trailing comma after the last item, single quotes, and an unquoted key. The error message points to the exact character where parsing failed.

Pretty print vs minify

Pretty printing adds newlines and indentation so humans can read nested structures; it is what you want in config files, API documentation and debugging. Minifying strips all whitespace, typically cutting size by 20–40%, and is what you want for network payloads, environment variables or embedding JSON in HTML attributes. Both are lossless: the data is identical.

Sorting keys

Object key order does not matter to JSON parsers, but sorted keys make diffs and code reviews far easier. The sort is recursive and leaves array order untouched, since arrays are ordered by definition.

Numbers and precision

The formatter uses your browser's native JSON parser, which stores numbers as 64-bit floats. Integers above 253 (about 9 quadrillion) and long decimals may be rounded; if you work with such IDs, keep them as strings.

Privacy

Everything runs in your browser. API responses containing tokens or personal data are safe to paste here because no request is made to any server.

Frequently asked questions

Why does it say "Unexpected token" on valid-looking JSON?

Usually a trailing comma, single quotes, or a comment. JSON allows none of those. The reported line and column show where.

Does minifying change my data?

No. Only whitespace is removed; values, key order and nesting are unchanged.

Can I format very large JSON files?

Files of several megabytes format in under a second. Very large files (100 MB+) may exceed browser memory.

Is my JSON sent anywhere?

No. Parsing happens in your browser using the built-in JSON engine.

Privacy

This tool runs entirely inside your browser using WebAssembly and the Canvas/File APIs. Your files are never uploaded to ToolFlint or any third party; you can verify this in your browser's network tab or by switching to airplane mode after the page loads. Read how we process files.

Last updated 2026-09-23.