JSON Formatter & Validator — Beautify, Minify and Find Errors

Beautify, minify and validate JSON with exact error positions, key sorting and a collapsible tree view.

Free, with no sign-up and no watermark. The file is processed in your browser and never uploaded.

Paste JSON and get it neatly indented, minified, or checked for mistakes. When the JSON is invalid the tool tells you what is wrong and the exact line and column, and highlights the line number — far easier than hunting for a missing comma by eye. Valid JSON also gets a collapsible tree view for exploring big API responses.

Step by step

  1. Add JSON: Paste it into the JSON box, use Open file for a .json file, or Load sample to try it out.
  2. Pick a mode: Beautify indents with 2 spaces, 4 spaces or tabs; Minify removes all whitespace.
  3. Optional: sort keys: Tick Sort keys A–Z to order every object's keys alphabetically — handy before comparing two files.
  4. Fix errors: If something is wrong, a red message explains it, e.g. Expected "," or "}" at line 12, column 5.
  5. Copy or download: Use Copy or Download under the output, or explore the tree view below it.

Handy for

Reading API responses

Turn a one-line response from an API or log file into something readable.

Debugging config files

Find the trailing comma or unquoted key breaking a package.json or settings file.

Shrinking payloads

Minify JSON before embedding it in code or sending it over the network.

Clean diffs

Sort keys and use consistent indentation so two versions compare cleanly.

Good to know

  • JSON needs double quotes around keys and strings; single quotes and trailing commas are not allowed — the error message calls these out specifically.

  • Comments are not part of JSON. Remove // or /* */ comments before validating.

  • For YAML or XML, use the YAML to JSON or XML Formatter tools instead.

Questions

Why does it say my JSON is invalid when it works in JavaScript?

JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. Strict JSON allows none of them.

Is there a size limit?

Only your device's memory. Files of several megabytes format in well under a second; the line-number gutter stops at 20,000 lines, and the tree view is skipped for documents over 2 MB (and shows the first 500 items of very long arrays).

Does sorting change my data?

Only the order of keys inside objects. Array order and all values stay exactly the same.

Is my data sent anywhere?

No. Everything is processed by JavaScript in your browser tab — nothing you paste or open is uploaded, logged or stored on a server. You can even use the tool offline once the page has loaded.

Further reading

More Developer Tools tools

  • JSON to CSV Converter — Turn a JSON array into CSV with nested fields flattened to dot paths and a choice of delimiter.
  • CSV to JSON Converter — Convert CSV or TSV into a JSON array, with header detection, type inference and nested keys from dot paths.
  • JSON to XML Converter — Convert JSON into well-formed, indented XML with configurable root element and attribute handling.
  • XML to JSON Converter — Parse XML into JSON, keeping attributes under a prefix you choose and converting numbers and booleans.
  • YAML to JSON Converter — Convert YAML (including multi-document files) into JSON using a safe loader that never runs custom tags.
  • JSON to YAML Converter — Turn JSON into clean YAML with configurable indentation, ready for config files and Kubernetes manifests.

All Developer Tools tools