TheTools.World tool

JSON formatter and validator online

Paste JSON to validate it and format it with readable indentation, or minify it into a single compact line. Invalid JSON shows a clear error message so you can find and fix the problem.

Format or validate JSON

Paste JSON to validate it and format it with readable indentation, or minify it into a single compact line. Invalid JSON shows a clear error message so you can find and fix the problem.

How to format or validate JSON

  1. Paste your JSON into the box.
  2. Choose an indent size, or check Minify to compress it to one line instead.
  3. Click Format JSON.
  4. If the JSON is valid, review the formatted result and check the summary (type and top-level key/item count).
  5. If the JSON is invalid, read the error message, which usually points to the approximate position of the problem.

This tool validates strict JSON syntax. JavaScript object literals with unquoted keys, trailing commas, or single-quoted strings are not valid JSON and will be reported as errors.

What this does and how it works

This tool parses your input using the browser's built-in JSON.parse, which enforces strict JSON syntax: double-quoted keys and strings, no trailing commas, and no comments. If parsing succeeds, the result is re-serialized with JSON.stringify using your chosen indentation (or compacted to one line if Minify is checked). If parsing fails, the browser's own error message is shown, which typically includes the character position or line/column where the problem was found.

Best practices

Common mistakes to avoid

Real-world use cases

Limitations

This tool checks JSON syntax validity only; it does not check the data against a schema, so syntactically valid JSON with the wrong structure for your specific use case will still pass. It also does not preserve key order guarantees beyond what JavaScript's JSON.parse/stringify already provide, and does not support JSON5 or JSONC extensions like comments or trailing commas.

Privacy

JSON you paste is processed locally in your browser using the browser's built-in JSON parser. It is not sent to a server, logged, or stored. See the privacy policy for the site's full data handling approach.

Troubleshooting

Conclusion

Use this tool to validate, pretty-print, or minify JSON quickly, with a clear error message when something's wrong. For formatting HTML or XML instead, see the HTML formatter or XML formatter.

FAQ

Why does my JavaScript object fail to validate?

Strict JSON requires double-quoted keys and strings, no trailing commas, and no comments. JavaScript object literals allow all of these, so a valid JS object may not be valid JSON.

What does the error message tell me?

It's the browser's own JSON parser error, which usually includes the character position or line/column of the first syntax problem found.

Does minifying change the data?

No. Minifying only removes whitespace and line breaks; the underlying data structure and values are unchanged.

Is my JSON uploaded anywhere?

No. Parsing and formatting happen locally in your browser using its built-in JSON parser, and your data is not sent to a server.