How to use it
- Paste your JSON into the left box, or type it.
- The result updates as you type: valid JSON is formatted on the right, invalid JSON shows the line and column of the problem.
- Choose 2 or 4 spaces, tabs or Minify, and turn on Sort keys if you want keys in A–Z order.
- Copy the result or download it as a .json file.
What this JSON formatter does
API responses, log lines and config files often arrive as one long line of JSON that is hard to read. The formatter parses the text with the browser's own JSON parser, the same one your JavaScript code uses, and prints it back with clean indentation. Because it really parses the data, it is also a validator: if a comma is missing or a quote is wrong, you get the exact line and column instead of a vague "invalid" message.
Stringified JSON, the kind you see inside logs as "{\"id\":1}", is detected and unescaped automatically, so you can paste it straight from a log viewer. The As a string option does the opposite and gives you JSON.stringify output, ready to paste into code or a test fixture.
Tips
Minify before sending JSON in a URL, header or environment variable, where spaces waste room. Sort keys before comparing two documents by eye, or use JSON Diff to compare them properly. JSON does not allow comments or trailing commas; if your file has them, it is probably JSON5 or JSONC, which many editors accept but JSON.parse does not.
Questions
- Why does it say my JSON is invalid?
- The most common causes are a trailing comma after the last item, single quotes instead of double quotes, comments, or unquoted keys. The error shows the line and column where parsing stopped; the real mistake is usually just before that point.
- Does it change my numbers or data?
- No. Values are kept as they are. One limit of all JavaScript-based tools: whole numbers larger than 9,007,199,254,740,991 lose precision, so very large IDs should be stored as strings.
- Can it handle large files?
- Yes, several megabytes format in well under a second on a normal phone or laptop. Very large files (100 MB+) depend on your device's memory.
- Is what I paste sent to a server?
- No. The tool runs as JavaScript in your browser. Your text, files and keys stay on your device, so it is safe to use with internal data, tokens and customer records. It keeps working offline after the page has loaded once.