What the JSON Formatter and Validator does
The JSON Formatter and Validator turns compressed or messy JSON into readable, indented text, or squeezes it back into a single line. As you paste, it checks that the JSON is valid and, if not, points to the exact line and column of the problem with a plain explanation. Because it runs in your browser, API responses, config files and tokens never leave your machine.
How to use it
- Paste JSON into the Input box. The Output updates as you type.
- Choose Format for indented output, or Minify for the smallest single line.
- Pick the indent: 2 spaces, 4 spaces or tabs. Tick Sort keys A to Z to order every object’s keys.
- If the status line shows an error, go to the line and column it names and fix it.
- Copy the result or download it as a .json file.
Example
An API returns {"id":7,"tags":["a","b",],"active":true} and your code fails to parse it. Paste it in and the status line reads “Line 1, column 25: Trailing comma before “]”.” Remove the comma after "b" and the formatter shows the object neatly indented with “Valid JSON” in the status line.
Common JSON mistakes it catches
- Trailing commas after the last item in an object or array.
- Single quotes instead of double quotes around strings and keys.
- Keys without quotes, as in JavaScript objects.
- Line breaks inside a string, which must be written as
\n. - A missing closing bracket or brace, reported as “The JSON ends too early”.
Sorting keys is useful before comparing two JSON files, because the same data written in a different key order then lines up exactly.
Questions people ask
Is it safe to paste API keys or customer data?
Yes. The JSON is processed in your browser and never sent to a server.
Does minifying change my data?
No. It only removes spaces and line breaks between values. Strings, numbers and their order stay the same, unless you also choose to sort keys.
Can it handle large files?
Files of several megabytes work on most computers. Very large files may take a moment to format on a phone.
Does it accept comments?
No. Standard JSON does not allow comments, so they are reported as errors. Remove them before formatting.