Tinkr
All tools
Developer·Live· Formatted in your browser

JSON Formatter

Paste JSON. Get a pretty-printed, validated, optionally key-sorted result — plus a one-line minified version. Everything runs locally in your browser. Sensitive payloads stay on your machine.

Indent

Frequently asked questions

Is my JSON sent to a server?
No. The parsing, pretty-printing, minifying, and key-sorting all happen in your browser via the built-in JSON.parse and JSON.stringify APIs. You can disconnect from the internet and the tool still works. Safe for configs, secrets, and API responses with sensitive data.
What's the difference between formatting and minifying JSON?
Pretty-printing (formatting) adds indentation and line breaks so humans can read the JSON. Minifying strips all whitespace to produce the smallest valid string — useful for transmission, storage, or Etag-style fingerprints. The data is identical either way; only the whitespace differs.
Why does my JSON say 'Unexpected token' or 'Unexpected end'?
Common causes: trailing commas (illegal in JSON), single quotes instead of double quotes, unquoted property names, or unescaped characters in strings. JSON5 / JSONC (with comments) is also not standard JSON. The error message includes the position; this tool converts that to a (line, column) pair to help you find it.
Can I sort the keys alphabetically?
Yes — toggle 'Sort keys' on. The tool recursively sorts every object's keys alphabetically. Arrays preserve their order (sorting them would change semantics). Useful for diffing two JSON blobs to spot added, removed, or changed keys regardless of original key order.
How big a JSON can it handle?
Browser-bound. Most modern browsers handle multi-megabyte JSON fine. For very large files (50MB+), the textarea may lag during typing — use the 'Format in place' button to apply formatting once and stop continuous re-rendering.
Does it support JSON5 or JSONC (JSON with comments)?
No. This tool follows the strict JSON spec — no trailing commas, no comments, no single quotes. If you need to format a JSON5 or JSONC file, strip the non-standard parts first or use a JSON5-aware tool.
Why does the minified version sometimes save 30–80%?
Pretty JSON spends most bytes on indentation and newlines, especially for deeply nested data. Minifying removes all of that. The savings depend on nesting depth and indent width — 4-space indented JSON minifies more dramatically than 2-space.
Can I copy just the minified or just the pretty version?
Yes. Each output panel has its own Copy button. The pretty version respects your indent setting (2 spaces, 4 spaces, or tabs) and key-sorting toggle; the minified version is always sorted-or-not based on the same toggle and is whitespace-free.

Related tools