JSON formatter & validator

Validate JSON syntax and format indentation for easier reading, or minify the output to remove unnecessary whitespace.

Ready to useIn your browser · no account

How to use

  1. Paste JSON in the input field, keeping an original copy if it contains numbers that require exact precision.
  2. Choose 2-space or 4-space indentation and use Format to organize the output. Use Minify to remove whitespace or Validate to check syntax.
  3. Review the separate output or error message. Invalid JSON remains in the input so you can correct it.

How it works

Transformation uses JSON.parse and JSON.stringify: comments are not accepted, duplicate keys keep only the last value, and numbers beyond JavaScript's safe precision may be rounded. Keep the original when working with precision-sensitive data.

An example

The JSON {"name":"Multi","active":true} can be displayed on separate indented lines. Minifying puts the same values back onto a single line.

Common questions

Why can a JavaScript object be rejected as JSON?

JSON requires double quotes around keys and strings. It does not accept comments, a trailing comma after the last item, undefined, or functions. For example, use {"active":true} rather than {active:true}.

What happens when the input is invalid?

The tool reports the parsing error and preserves your input so you can fix it. It does not guess values or automatically repair the structure.

Does formatting preserve the file exactly?

No. The result preserves values that the parser can represent, but may change whitespace, the order of some keys, and how numbers are written. For long identifiers that are not used in calculations, consider quoted strings in the source.