Toolkit
Developer tools

JSON Formatter & Validator

Pretty-print, minify and validate JSON with precise error positions.

Mode
JSON input
Formatted

Valid JSON.

About this tool

Paste raw JSON to reformat it with consistent indentation, or minify it down to a single line. If the document will not parse, the exact line and column of the problem is reported instead of a generic failure.

How to use it

  1. Paste or type your JSON into the input pane.
  2. Choose an indent width, or switch to Minify to strip all whitespace.
  3. Copy the formatted output or download it as a .json file.

The four errors that cause almost every failure

Invalid JSON is nearly always one of a handful of mistakes. JSON is a much stricter format than the JavaScript object literals it resembles, and that gap is where people get caught.

Trailing commas. Perfectly legal in modern JavaScript, illegal in JSON:

{ "name": "Ada", "role": "engineer", }

Single quotes. JSON requires double quotes on both keys and string values. {'name': 'Ada'} is a valid JavaScript object and invalid JSON.

Unquoted keys. {name: "Ada"} parses fine in a browser console but fails here — every key must be a quoted string.

Comments. JSON has no comment syntax at all. If your config file contains // or /* */, it is JSONC or JSON5, not JSON, and needs a parser that understands those.

Why the error says line and column

Browsers report JSON errors as a character offset — "position 1847" — which is useless when you are looking at a 400-line file.

This tool converts that offset into a line and column, and where the browser reports no offset at all it locates the surrounding snippet and names the line instead. Either way you get somewhere to look rather than a number to count to.

Frequently asked questions

Why does my JSON fail to validate?
The most common causes are trailing commas, single quotes instead of double quotes, and unquoted object keys. All three are valid JavaScript but invalid JSON. The error message points at the offending line and column.
Can it handle very large files?
Yes, within your browser's memory. Documents of a few megabytes format instantly; extremely large files may take a moment since parsing happens on the main thread.
Is my JSON sent to a server?
No. Parsing and formatting happen in your browser via JSON.parse, so even production payloads containing customer records or API keys stay on your machine.