A JSON formatter that finds your mistake for you

An API response squashed onto one line is almost impossible to read, and a single missing comma can break a whole config file. Paste the text into this JSON formatter and it turns it into neat, indented JSON, or tells you exactly which line and column went wrong.

Format, validate and minify with one JSON formatter

The same box works as a JSON validator and JSON beautifier, and the Minify button lets you minify JSON when you need the smallest possible file. Choose two spaces, four spaces or tabs for indentation, and tick Sort keys if you want properties in alphabetical order, which makes two files much easier to compare. A short summary shows how deep the data goes and how many objects, arrays and values it holds.

How to use JSON Formatter

  1. Paste your JSON into the input box, or type it in.
  2. Pick the indentation you prefer: 2 spaces, 4 spaces or a tab. Tick Sort keys if you want alphabetical order.
  3. Solve the security check and press Format, Minify or Validate.
  4. If something is wrong, read the error message. It names the line and column to look at.
  5. Copy the result or download it as a .json file.

About JSON Formatter

The tool uses the JSON parser built into your browser, so what counts as valid follows the official JSON rules exactly. Format adds indentation, Minify removes every unneeded space, and Validate only checks the text without changing it. When parsing fails, the browser's message is turned into a line and column so you can jump straight to the problem. For valid JSON the structure panel counts keys, objects, arrays, strings, numbers, booleans and nulls, and reports the deepest level of nesting.

Purpose of JSON Formatter Tool

Developers paste API responses and log lines to read them, testers check request bodies, and anyone editing a package.json, a settings file or a data export can use the validator to find the stray comma before an app refuses to start. Sorting keys is handy before comparing two versions of a config side by side. Because everything happens locally, it is also a reasonable choice for data you would rather not paste into an online service.

Limitations of JSON Formatter

  • Only strict JSON is accepted. Comments, trailing commas, single quotes and unquoted keys, which JavaScript or JSON5 allow, are reported as errors.
  • Whole numbers larger than 9,007,199,254,740,991 may be rounded, because the browser reads numbers as floating point. If you handle big IDs, keep them as strings.
  • If an object repeats a key, only the last value is kept and the earlier ones disappear from the result without a warning.
  • Keys that look like whole numbers, such as "2" or "10", are moved to the top in number order, even when Sort keys is off. That is how JavaScript objects work.
  • It checks that JSON is well formed, not that it matches a schema, and very large files (tens of megabytes) can make the page slow.

Privacy and data

JSON Formatter runs entirely in your browser. What you type or select is processed on your own device and is never sent to or stored on our server. See our Privacy Policy for details.

Frequently asked questions

What is the difference between formatting, minifying and validating JSON?

Formatting adds line breaks and indentation so people can read it. Minifying removes all unneeded spaces to make the file smaller. Validating only checks that the text follows the JSON rules, without changing anything.

Why does my JSON show an error when it works in JavaScript?

JSON is stricter than JavaScript. Keys and strings must use double quotes, and comments or a trailing comma after the last item are not allowed. The error message gives the line and column of the first problem it finds.

Is it safe to paste private JSON here?

Your JSON is parsed in your browser and never sent to our server, so API responses and config files stay on your device. Still, avoid pasting live passwords or secret keys into any website out of habit.

How do I validate JSON and find the error?

Paste the JSON and run validate. If it is not valid, the message gives the exact line and column of the first problem, such as a missing quote or a trailing comma.

How do I minify JSON or sort its keys?

Choose minify to remove all unneeded spaces, or sort keys to put the keys of every object in alphabetical order. You can also pick the indent size when you format.

Rate JSON Formatter

No ratings yet. Be the first to rate this tool.

Your rating

Report a bug or give feedback

Tell us about JSON Formatter. The subject of your message will name this tool.