JSON Formatter
Format, validate and minify JSON with a collapsible tree view, exact error line and column, key sorting and JSON5/JSONC support. Runs entirely in your browser.
🔒 Runs entirely in your browser — nothing is uploadedWhat JSON Formatter does
JSON Formatter validates JSON as you type, then writes it back either with readable indentation (2 spaces, 4 spaces or tabs) or as a compact one-line value. It is useful for inspecting API responses, package metadata, configuration snippets, webhook payloads, browser storage values, and test fixtures. When the input is invalid, the tool reports the exact line and column, prints the offending line with a caret under the problem, and can jump the cursor straight to it — so trailing commas, missing quotes and unbalanced brackets are found in seconds.
Valid documents are also shown as a collapsible tree. Objects and arrays display how many keys or items they hold, children are rendered only when you open a node so large files stay responsive, and clicking a key copies its JavaScript path such as $.orders[3].total. Sort keys alphabetically to make two payloads easier to compare, and open or download .json files directly. Configuration files often use JSONC or JSON5 with comments, single quotes and trailing commas; enable the lenient option to read them and convert them to strict JSON.
Private browser-based workflow
All processing happens with in-browser JavaScript. The tool does not upload your text, tokens, URLs, snippets, or generated values to a server, and it does not require an account. That privacy model is important because small utilities often receive real API responses, configuration samples, logs, authentication data, or customer-shaped examples during troubleshooting. Keeping the work local reduces risk and also makes the tool feel instant because there is no network round trip.
Practical tips
Use pretty print while reading nested data and minify when you need a compact value for an environment variable, a fixture, or a documentation example. Sorting keys changes only the order of object properties, never array order, so it is safe for configuration but may matter if a consumer relies on property order. Your draft is kept in this browser for a few days, so an accidental reload does not lose it — use Clear when you are working with sensitive data. Very large numbers beyond JavaScript's safe integer range lose precision when parsed, which is a property of JSON in the browser rather than of this tool.
How to use
- Paste or open JSONPaste JSON or open a .json file; it is validated as you type.
- Choose optionsPick 2 spaces, 4 spaces or tabs, sort keys, and allow JSON5/JSONC if needed.
- Format, explore and copyPretty print or minify, browse the tree view, then copy or download the result.