Internative Logo

JSON Formatter and Validator: Format, Minify and Check JSON in Your Browser

JSON Formatter and Validator: Format, Minify and Check JSON in Your Browser

JSON is the format most web services use to exchange data, and it is easy for machines to read and hard for people to read when it arrives on a single line. The tool below turns that line into indented, readable JSON, or squeezes readable JSON back into one compact line, and tells you where the syntax is broken when the input is not valid. It runs in your browser, so the data you paste is not sent anywhere.

JSON formatter

Paste JSON to check it and make it readable, or to squeeze it onto one line. The result updates as you type.

Output

What you enter never leaves your browser. Nothing is sent or stored.

How to use the formatter

  1. Paste your JSON into the input field.
  2. Press Format to get the output indented with two spaces, or Minify to remove every space and line break that is not part of a value.
  3. If the JSON is not valid, the tool shows the error message from the browser's JSON parser, which usually names the unexpected character or the position where parsing stopped.
  4. Copy the result, or press Clear to start again.

Formatting does not change the data. It parses your JSON and writes it out again, so the values and the order of keys stay the same. Duplicate keys in an object are the exception: the parser keeps only the last one.

What it is useful for

  • Reading an API response or a webhook payload while debugging an integration.
  • Finding the missing comma or bracket in a configuration file.
  • Making a sample payload readable before it goes into documentation or a ticket.
  • Minifying JSON before you embed it in a request, a query string or a test fixture.
  • Checking that data you are about to send is valid at all.

Mistakes that make JSON invalid

  • Trailing commas. {"a": 1,} is valid in JavaScript objects but not in JSON.
  • Single quotes. JSON strings and keys need double quotes.
  • Unquoted keys. {a: 1} is not JSON. Write {"a": 1}.
  • Comments. JSON has no comment syntax. Remove them or move them into a separate field.
  • Values JSON does not have. undefined, NaN and Infinity are not allowed. Use null or a string.
  • Unescaped characters in strings. A line break or a double quote inside a string must be escaped as \n or \".

Where formatting stops helping

A formatter tells you that data is well formed. It cannot tell you that it is correct: that a field has the right type, that a required field is present, or that two systems agree on what a field means. That is where schema validation and integration code come in. When data moves between your systems and has to be mapped, validated and retried without anyone reformatting it by hand, that is the work of system integration and, when it is part of a product, custom software development.

Frequently asked questions

Is my JSON sent to a server?

No. The text is parsed and formatted in the page on your device. The tool makes no network request with it and does not store it.

Why does the tool say my JSON is invalid when it works in my code?

Your code may be accepting something JSON does not, such as single quotes, comments or trailing commas, which JavaScript and some libraries tolerate. The formatter follows the strict JSON standard.

Does minifying change my data?

No. It removes only whitespace outside of strings. The values, their types and the order of keys remain the same.

Does formatting change the order of keys?

No. Keys are written back in the order they were parsed. One caution: JSON objects are defined as unordered, so do not build logic that depends on key order.

Is there a size limit?

The page works on what a browser can hold in memory, so very large files may be slow. For multi-megabyte files, a command-line tool is a better fit.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.