How to format, validate and fix JSON
Turn messy JSON into readable, indented text, find the exact line of a syntax error, and shrink it back down.
Open the JSON Formatter & Validator โ
JSON from an API or a log is usually one long line. Formatting adds indentation so you can read it; validating tells you whether it is legal JSON at all.
Steps
- Open the JSON Formatter.
- Paste your JSON (or press Sample to see how it works).
- Set Mode to Format, Minify or Validate only.
- Copy or download the result.
Options: Indent (2 spaces, 4 spaces or tab) and Sort keys AโZ, which makes two files easy to compare.
Reading an error
When the JSON is invalid, the message points at the line. The mistakes we see most:
- A trailing comma after the last item.
- Single quotes instead of double quotes.
- An unquoted key, such as
{name: "Ada"}. - A missing closing bracket.
Fix the line it names, then run it again.
Need it as a spreadsheet?
The JSON to CSV tool turns a list of objects into rows. If you paste JSON into the CSV โ JSON direction by mistake, it tells you to switch direction.
Private by design
API responses often contain real customer data. This formatter runs in your browser, so what you paste is not sent to us.
Related tools
JSON to CSV ยท JSON to XML ยท Base64 ยท JWT Decoder