Skip to content
Image tools
PDF and scan tools
Video and audio tools
Text and everyday tools
Bangladesh tools
How-to guides
Image tools
PDF and scan tools
Video and audio tools
Text and everyday tools
Bangladesh tools

JSON formatter and validator

ProPro
Loading the tool…

Format, validate and minify JSON in your browser. Errors show the exact line and column with a plain-English hint. Your data is never uploaded.

What this JSON formatter does

This free JSON formatter and validator checks your JSON as you type, shows exactly where any error is, and turns valid JSON into neatly indented text or a compact one-line version. You can paste JSON, type it, or drop a .json file on the input box.

How to format JSON

  1. Paste your JSON into Your JSON, or drop a file on it.
  2. Look under the box: Valid JSON in green, or the error with its line and column.
  3. Pick the Indent: 2 spaces, 4 spaces or Tabs.
  4. Optional: switch on Sort keys A–Z.
  5. Click Format for readable JSON or Minify for the smallest version.
  6. Copy or Download the result.

Reading the error messages

When the JSON is invalid, the tool shows what the browser’s parser reported, the line and column, and the line itself with a ^ under the problem. Show in input jumps to that spot. For the most common mistakes it adds a hint:

  • Trailing comma: {"a": 1,} has a comma before the closing brace. Remove it.
  • Single quotes: {'a': 1} must be {"a": 1}.
  • Unquoted keys: {a: 1} must be {"a": 1}.
  • Comments: JSON has no // or /* */ comments. Delete them first.

The exact wording of an error depends on your browser. Safari gives no position, so there you get the message without a line number.

Problems and fixes

  • Format and Minify are greyed out. The JSON is invalid. Fix the error shown below the input first.
  • Special characters look wrong. Make sure the file is saved as UTF-8.
  • Numbers change. Numbers beyond about 16 significant digits (like some IDs) lose precision in any browser JSON parser. Store long IDs as strings.

Privacy

Your JSON is checked and formatted in your browser and never leaves your device.

When Pro helps

Pro doesn’t add anything to this tool beyond removing ads.

Frequently asked questions

Is my JSON sent to a server?

No. Formatting and validation run in your browser, so API keys, customer records or anything else in your JSON stay on your device. That matters, because many online formatters send what you paste to their server.

Why does it say my JSON is invalid when JavaScript accepts it?

JSON is stricter than JavaScript. It needs double quotes around every key and string, and it does not allow trailing commas, comments, single quotes, undefined or NaN. The error message names the line and column, and often the exact fix.

What is the difference between format and minify?

Format (also called beautify or pretty print) adds line breaks and indentation so people can read it. Minify removes all of that so the file is as small as possible for sending over a network. Both keep the data exactly the same.

Does sorting keys change my data?

No. JSON objects have no meaningful key order, so sorting only changes how it reads. Arrays keep their order, because in arrays order does matter.

How big a file can it handle?

Files of several megabytes work well in a modern browser. Very large files (50 MB and up) depend on your device's memory and may be slow.