PK Systems
Developer tools

JSON Formatter

Beautify, minify, and validate JSON in your browser. Live updates, copy with one click — nothing leaves your device.

JSON Formatter

Output

Output appears here as you type.

What does this tool do?

JSON (JavaScript Object Notation) is the most common format for data interchange between APIs, config files, and modern web apps. This tool parses JSON in your browser and re-emits it with consistent indentation (Beautify), strips all whitespace (Minify), or just confirms it parses (Validate). It uses the browser's native JSON.parse, so what passes here is what every JavaScript runtime will accept. Nothing is uploaded — the whole pipeline runs locally.

How to use it

Paste your JSON into the input area. Pick Beautify for human-readable output (set indent to 2, 4, or tab), Minify to strip whitespace for transport, or Validate only to check syntax without producing output. Toggle Sort keys A→Z to make diffing two JSON files easier. The output updates live as you type. If the input is invalid, the tool tells you the line and column of the error so you can jump straight to the problem.

Tips and limits

  • JSON is strict: keys must be double-quoted, no trailing commas, no comments. If your input has those, fix them first.
  • Sorted keys produce stable output for git diffs and snapshot tests.
  • Beautified output with 2-space indent is the de-facto standard for config files (npm, composer, .vscode/settings.json).
  • Very large payloads (10MB+) work but the browser may stutter while parsing — minify large API responses for production use.
  • Numbers are parsed by JavaScript, which loses precision past 2^53. If you have BigInt-style IDs, keep them as strings.

Frequently asked questions

Is my JSON sent to a server?
No. Parsing, formatting and validation happen entirely in your browser using the native JSON.parse and JSON.stringify. Open DevTools > Network and you'll see no requests fire when you paste or edit. Safe for sensitive payloads, internal config files, or anything you wouldn't paste into a hosted service.
Why does my JSON show as invalid when it looks fine?
Most often: single quotes instead of double quotes around keys/strings, a trailing comma after the last item in an object or array, or unescaped line breaks inside a string. JSON is stricter than JavaScript object literals — the error message and line/column shown above the output point to the exact byte where the parser gave up.
What's the difference between Beautify and Minify?
Beautify adds line breaks and indentation so the structure is easy to scan — best for editing, code review, and debugging. Minify strips every optional whitespace character, producing the shortest valid representation — best for storage, transport, and embedding inside HTML attributes or query strings. Both produce semantically identical JSON.
What does "Sort keys A→Z" do?
It walks the entire object tree and emits each object's keys in alphabetical order. Arrays keep their original order (sorting array elements would change meaning). Sorting is useful for diffing two JSON files where the same data may have been emitted with different key orders by different tools.
Does it handle JSON5, JSONC, or comments?
No — only strict RFC 8259 JSON. Comments (// or /* */), trailing commas, single quotes, and unquoted keys are all rejected. If you need a relaxed dialect for tooling configs, parse with a JSON5 library before pasting here, or strip the comments first. We may add a JSON5 mode in the future.
Can it handle very large JSON files?
It can format files up to several megabytes without issue. Past 10–20 MB the browser tab may freeze briefly during parsing because JSON.parse is synchronous. For multi-hundred-megabyte logs or exports, use a streaming command-line tool like jq instead — it processes JSON as a stream and won't load the whole file into memory.