JSON Formatter and Validator - Clean Up JSON

Format, validate, and minify JSON in your browser. See clear error messages with line numbers. Nothing is sent to a server.

Your files never leave your device.

Ctrl/Cmd + Enter formats the JSON.

What this JSON formatter and validator does

JSON is a text format for structured data. It is used by APIs, configuration files, and data exports. This tool checks that JSON is valid, reformats it with consistent indentation, and produces a minified version with the whitespace removed. It is useful when a long single-line response needs to be readable, or when a configuration file is missing a comma or quote.

How to format or validate JSON

  1. Paste your JSON. Include the outer braces or brackets. The tool parses the text as standard JSON.
  2. Choose an indent. Two spaces, four spaces, or a tab.
  3. Format, minify, or validate. Format adds line breaks and indentation. Minify removes them. Validate only checks the syntax.
  4. Copy the output. If the JSON is invalid, the error message names the line and column when the browser provides them.

Common JSON errors

  • Trailing commas are not allowed after the last item in an object or array.
  • Comments are not valid JSON. Remove // and /* */ comments before validating.
  • Single quotes are not valid. JSON strings must use double quotes, and property names must be quoted.
  • Missing commas or brackets are the most common cause of a parse error. The reported position usually marks the first place the parser could not continue.

Tips

Formatting changes only the whitespace, not the data. Minifying can make a file smaller for transfer, but keep a readable copy if people need to edit it. Do not paste secrets such as API keys into any online tool unless you trust it; this page processes the text locally, but the clipboard and browser history are still your responsibility.

When to use it

Use the formatter when debugging an API response, checking a configuration file, or preparing JSON for documentation. For very large files, use a desktop editor with JSON support.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing, formatting, and validation all happen in your browser.

How does validation work?

The tool parses your input as strict JSON. If parsing fails, it shows the error message and the line and column where it occurred.

Can I minify JSON?

Yes. Switch to minify mode to remove indentation and extra whitespace.

Does it support comments or JSON5?

No. It accepts standard JSON only, so comments and trailing commas are reported as errors.