Format and validate JSON without pasting it into a server
LOCALAn API response arrives as one endless line, a config file has a trailing comma somewhere in 400 rows, and the log you want to inspect contains a customer token. This tool parses the text with the browser's own JSON parser, reports the first syntax error with its line and column, and rewrites the document with clean indentation. Everything happens in this tab: no request carries your data, no history is stored, and closing the page leaves no copy behind.
How it works
- 01
Paste the JSON
Drop the raw text into the input box, from a terminal, a REST client, a database row or an editor. Validation runs as you type: a green line confirms the document is syntactically valid and a red panel shows the first error with a line and column. The box accepts any size that fits in memory, but a 50 MB export is better inspected in a developer tool.
- 02
Read the error before you format
When parsing fails, nothing else is enabled until the syntax is fixed, because rewriting invalid JSON would silently guess what you meant. The message comes from the browser engine, so it names the exact token it choked on. Common causes are a trailing comma, single quotes, an unquoted key, a comment, or a byte-order mark at the start of a downloaded file.
- 03
Choose an action
Format rewrites the document with 2 spaces, 4 spaces or a tab per level. Minify removes every optional space and newline, which is what you want before putting JSON into a URL or a header. Sort keys walks the whole tree and orders object keys alphabetically while keeping array order untouched, useful for diffing two responses that list the same fields in a different order.
- 04
Copy or download
The output box is read-only so the result cannot drift from the action you ran. Copy it back to your editor, or download a .json file, which is handy when the formatted document is going into a repository. The output size is shown next to the buttons, and the smallest form is always the minified one.
When to use it
Debugging an API response
A fetch call returns a wall of text and you need to know whether the error field sits at the top level or inside a nested object. Paste it, format, and the structure becomes visible in seconds. If the response is truncated because a proxy cut the connection, validation fails at the end of the text and the error position tells you exactly where the document stops.
Fixing a config file
package.json, tsconfig.json and tool configs fail with a cryptic message when one comma is wrong. Paste the file, read the reported line, fix that line in the editor, and paste again. Sorting keys is optional here, but it makes a large config easier to scan and produces smaller diffs when two people edit different sections.
Cleaning data before sharing
Logs and fixtures often contain tokens, emails or internal IDs. Because this page never uploads or stores the text, it is a safer place to restructure a payload than a hosted formatter that keeps a history in local storage or on a server. That is a statement about this tool, not a guarantee about your clipboard or browser extensions.
Preparing JSON for transport
Minified JSON saves bytes in a query string, an environment variable or a webhook body, and it removes the accidental newlines that break shell commands. Format first to check the content, then minify, then copy. If a JSON string has to be embedded inside another JSON string, minify it before escaping so you do not double the whitespace.
Questions
Is my JSON uploaded anywhere?
No. Parsing and rewriting use the JSON object built into your browser, and the output is produced in the page. There is no API call carrying the text, no database write and no local storage entry. You can confirm it in the Network panel while formatting. The page itself only needs a connection the first time it loads.
What does the validator actually check?
It checks syntax against the JSON grammar used by JavaScript engines, which follows RFC 8259. It does not validate a JSON Schema, so a document can be valid JSON and still have the wrong fields or types for your application. For schema validation you need a separate tool that knows your schema.
Why does it say invalid when the JSON looks fine?
The most common causes are a trailing comma before a closing brace or bracket, single quotes around a key or string, an unquoted key, a // or /* */ comment, and a BOM left by a Windows editor. JSON allows none of these. The reported line and column point at the first offending character, so fix from there and validate again.
Does formatting change the data?
Formatting and minifying only change whitespace between tokens, so the parsed value stays identical. Sorting keys changes the order of object members, which is semantically irrelevant in JSON, but it does change the text and therefore a hash or a byte comparison. Array order is preserved because arrays are ordered by definition.
What happens to duplicate keys?
JSON.parse keeps the last value for a repeated key and silently drops the earlier ones. The output is rebuilt from the parsed value, so duplicates disappear. If the source has duplicate keys and you need to see them, inspect the raw text first; no formatter built on a standard parser can preserve both.
Why do large numbers look different after formatting?
JSON numbers are parsed into JavaScript doubles. Integers beyond 2^53 lose precision, so a 19-digit database ID can come back rounded. This affects every browser-based formatter that uses JSON.parse. Keep such IDs as strings in the source, or inspect the raw text instead of the rewritten output. A literal such as 1e999 overflows to Infinity, and the rewritten document shows null instead.
Can I sort keys in only part of the document?
No, sorting applies to the whole tree. Every object at every depth has its keys ordered alphabetically, while arrays keep their original order. If you need to reorder a single object, format first, edit that block by hand, and leave the rest untouched. Keys that are plain integers always come out in numeric order, because JavaScript objects enumerate them that way.
Is there a size limit?
There is no imposed limit, but the whole document is held in memory twice while parsing and rebuilding. On a phone, a file above roughly 20 MB can stall the tab. For very large exports, use a command-line tool such as jq, which streams data instead of loading it all at once.
Can it convert JSON to CSV or YAML?
No, this tool formats and validates JSON only. Converting to another data model is a different operation with its own edge cases, such as how to flatten nested objects for a spreadsheet. Keeping the scope narrow is also why the output never silently changes your data types.