JSON Formatter

JSON Formatter, Validator and Minifier

Paste your JSON below to instantly pretty-print, validate or minify it. Everything runs locally in your browser — your data is never sent to any server.

Input0 bytes
Output

What is JSON formatting?

JSON (JavaScript Object Notation) is the most widely used text format for exchanging structured data over the web — APIs, configuration files, log records, NoSQL documents and much more. Real-world JSON often arrives minified or with inconsistent indentation, which makes it hard to read and to debug.

A JSON formatter takes any valid JSON document and rewrites it with consistent indentation, predictable line breaks and (optionally) sorted keys. The reverse operation, minification, removes every byte that is not strictly required, which is useful before sending data over the network or embedding it in a binary.

How to use this tool

  1. Paste your raw JSON into the left input area, or click "Load sample" to try with example data.
  2. Choose the output mode — Pretty for human reading, Minify for transport.
  3. If you picked Pretty, choose the indentation (2 spaces, 4 spaces, or tab) and optionally enable "Sort keys" to alphabetise object keys.
  4. The result appears instantly on the right. Click Copy to put it in your clipboard. If your JSON is invalid, the exact parse error and its location are shown.

Frequently asked questions

Is my data sent to a server?

No. Every formatting and validation operation runs entirely in your browser using the native JSON parser. Your input never leaves your machine, which makes the tool safe to use even with sensitive payloads.

What is the maximum JSON size I can paste?

There is no hard limit beyond what your browser's memory allows. In practice, files up to a few hundred megabytes work, although the UI can become sluggish past a few tens of megabytes. For huge files, prefer a desktop tool like jq.

Why does my JSON show an error like "Unexpected token"?

Most often it is a missing or extra comma, an unquoted key, single quotes instead of double quotes, or a trailing comma after the last item. Check the byte position reported in the error message — it points exactly at the first invalid character.

What does "Sort keys" do?

It alphabetises the keys of every object in your JSON, recursively. Sorted output is useful for diffs, deterministic hashing, or when comparing two JSON documents that should be semantically equivalent.

Does the formatter preserve number precision?

Numbers are reformatted using the JavaScript number type, which provides about 15-17 significant decimal digits. If your JSON contains very large integers (e.g. 64-bit IDs), they may lose precision when re-serialised. Such IDs are typically transmitted as strings for that reason.