Free developer tool

JSON Formatter and Validator

Paste your JSON and the tool checks that it is valid, then formats it with indentation or compresses it into one line. Errors are explained in plain words.

What is json formatter and validator?

JSON is the standard format for data in APIs, config files and web apps. A single missing comma or quote breaks it, and reading minified JSON by eye is hard.

This tool validates the syntax with the same parser that browsers use, then pretty prints it so you can read the structure, or minifies it to save bytes.

How to use the json formatter and validator

  1. Paste your JSON into the box.
  2. Choose indentation or tick minify.
  3. Press Calculate and copy the output.

How the json formatter and validator works

The text is parsed with JSON.parse. If it fails, the parser message is shown. If it succeeds, the object is written back with JSON.stringify using your chosen indentation.

Worked example

The compact text {"a":1,"b":[2,3]} becomes a multi line version with each key on its own line.

Common uses of the json formatter and validator

  • Reading an API response that arrives as one long line.
  • Finding the missing comma or quote that breaks a config file.
  • Minifying JSON before sending it over the network.
  • Preparing sample data for documentation.
  • Checking a webhook payload during debugging.

Tips and common mistakes

Common errors are trailing commas, single quotes around strings and unquoted keys. JSON allows none of these.

Do not paste secrets or private tokens into online tools unless you trust them. This one works locally in your browser.

Background: what to know before you rely on it

JSON, short for JavaScript Object Notation, was popularized by Douglas Crockford in the early 2000s as a lighter alternative to XML. It is now the default format for web APIs and many config files. It supports objects, arrays, strings, numbers, booleans and null, and nothing else. There are no comments, no trailing commas, no single quotes and no undefined values, which is why hand edited files often fail. Formatting a file does not change its meaning, only its whitespace. Minifying removes whitespace to save bytes, which matters for large payloads but makes reading harder, so keep a formatted copy for people.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Frequently asked questions

How do I validate JSON?

Paste it here and press Calculate. Errors are shown with a message.

What is the difference between format and minify?

Format adds indentation for reading. Minify removes whitespace to save space.

Does it send my data anywhere?

No.

Are comments allowed in JSON?

No. Standard JSON does not allow comments.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.