JSON Formatter
Format valid JSON, inspect its tree, and locate syntax errors.
Runs in your browser. Nothing is uploaded.
Format or validate JSON to see a tree.
Common JSON errors
Trailing commas are the most common mistake. JSON does not allow a comma after the last property. JavaScript object literals often do, so copy-paste from code will fail until you remove that comma. Single quotes are the next trap: JSON strings must use double quotes. Comments are also invalid in JSON, even though JSONC and some config files allow them.
If a key is repeated, this tool follows the browser: the last value wins. That is not a pretty-printer quirk. It is how JSON.parse works. If you need to detect duplicates, you need a different parser than the one every browser ships.
Formatter, beautifier, validator, or minifier?
A formatter and a beautifier are two names for the same basic job: parse valid JSON and write it with consistent indentation. This page also has a Validate action that checks the syntax without replacing your output, and a Minify action that removes whitespace for a compact payload. Sort changes object key order when you need stable-looking output for a review. None of these actions changes the meaning of valid JSON, but sorting can make a meaningful difference to a text-based diff.
The useful sequence is simple. Paste or drop a file, read the error if parsing fails, then choose an indentation width and Format. If another system needs the smallest representation, use Minify after the document is valid. Copy the result or download it as formatted.json. The input stays visible so you can compare what changed.
Large files and browser limits
Normal JSON is parsed in the page. Larger inputs, including dropped JSON files above roughly 200 KB, can run in a Web Worker so the editor has a better chance of staying responsive. The worker still runs in the page and does not bypass browser memory limits. A very large document can still take time or fail before formatting finishes. If that happens, split the file locally and work on one part at a time.
Error messages include a line and column when the browser can identify them. Jump to that location, check the character before it, and look for a missing quote, bracket, or comma. JSON syntax errors are often reported at the point where parsing becomes impossible, not at the original typo.
What this tool does not do
This is a syntax tool, not a JSON Schema validator, API contract checker, or data quality audit. It does not fetch a URL, resolve references, run JavaScript, or send your paste to a server. Valid JSON can still contain the wrong fields, unsafe values, or a secret that should not be shared. Review the content before copying it into a ticket or log.
For two valid documents, use JSON Diff to see paths that were added, removed, or changed. For an array that needs a flat export, use JSON to CSV. The guide How to format and validate JSON explains the same workflow with examples.
FAQ
Does JSON Formatter send dropped files for parsing?
No. A dropped file is read as text and parsed in your browser, with larger jobs moved to a Web Worker. The JSON is never uploaded, and TheDevTab never receives it.
What is the difference between a formatter, a beautifier, and a validator?
A formatter, also called a beautifier, rewrites parsed JSON with consistent indentation, while a validator only checks whether the text is legal JSON. This page also minifies, sorts object keys recursively, and shows a tree view after a successful parse.
Why do I get an error about a trailing comma?
Standard JSON does not allow a comma after the last property in an object or the last item in an array. Remove the trailing comma because this formatter uses JSON.parse rather than a JSON5-style parser.
Can I format a large JSON file?
Yes. When the input reaches 200,000 characters and a Worker is available, the page sends the JSON job to its Web Worker. Very large values can still exceed the memory available to the browser.
Can this tool minify JSON as well as format it?
Yes. Format serializes parsed values with the selected indentation, while Minify uses compact JSON without unnecessary whitespace. Both operations parse the input first, so invalid JSON still needs to be fixed.
Does the formatter detect duplicate keys?
No. JSON.parse keeps the last value when an object repeats a key, and this formatter receives only that parsed result. It does not report duplicates or claim that every downstream parser will make the same choice.