JSON Formatter and Validator

Paste JSON to beautify it with clean indentation, minify it for production, or validate it and see exactly where a syntax error is. Everything runs in your browser, so API responses and config files never leave your device.

  • 100% free, no sign-up
  • Runs in your browser: text never uploaded
  • Instant results

How to use the JSON Formatter

  1. Paste your JSON, upload a .json file, or click Sample.

  2. Choose an indentation: 2 spaces, 4 spaces or tabs.

  3. Click Format to beautify, Minify to remove whitespace, or Validate to check without changing it.

  4. If there is an error, read the line and column in the message, fix it, and try again. Download or copy the result.

Examples

Beautify
Input
{"name":"Ada","skills":["math","code"],"active":true}
Result
{
  "name": "Ada",
  "skills": [
    "math",
    "code"
  ],
  "active": true
}
Catch a trailing comma
Input
{"a": 1,}
Result
Error: JSON does not allow a comma before a closing brace (line 1, column 9)

What the formatter does

Format (beautify) parses your JSON and prints it again with consistent indentation and one property per line, which makes nested objects and arrays easy to scan. Minify removes every unnecessary space and line break, producing the smallest valid JSON for APIs, config files and storage. Validate checks the syntax without changing anything.

Because the formatter fully parses the input, the output is guaranteed to be valid JSON. Key order and values are preserved exactly.

The most common JSON errors

JSON is stricter than JavaScript. These mistakes cause most validation failures:

  • Trailing commas: {"a": 1,} is invalid. Remove the comma after the last item.
  • Single quotes: strings and keys must use double quotes, "name" not 'name'.
  • Unquoted keys: {name: "Ada"} must be {"name": "Ada"}.
  • Comments: // and /* */ are not allowed in standard JSON.
  • Special values: undefined, NaN and Infinity are not valid. Use null or a string.
  • Unescaped characters: quotes and backslashes inside strings must be escaped as \" and \\, and raw line breaks must be written as \n.

JSON syntax at a glance

A JSON document is a single value, usually an object {} or an array []. Objects hold "key": value pairs separated by commas. Values can be strings in double quotes, numbers, true, false, null, objects or arrays, nested to any depth. Numbers cannot have leading zeros or a trailing decimal point.

Working with spreadsheet data? Convert it with the CSV to JSON Converter. Need to embed JSON in a URL or a header? Use the URL Encoder or the Base64 Encoder.

Privacy and large files

Many online formatters send your data to a server. This one does not: parsing and formatting use your browser's built-in JSON engine, so API keys, tokens and customer data in your payload stay on your machine. Files up to about 10 MB format in a moment on a modern computer.

When to beautify and when to minify

Beautify whenever a human needs to read or edit the JSON: debugging an API response, reviewing a configuration file, writing documentation or comparing two payloads. Consistent indentation also makes version-control diffs much cleaner.

Minify when the JSON is consumed by machines: API responses, data embedded in HTML, local storage or files shipped to users. Removing whitespace typically shrinks pretty-printed JSON by 10 to 30%, though server compression such as gzip narrows the gap. Keep a formatted copy for editing and minify as a build step.

Frequently asked questions

The formatter runs entirely in your browser and does not upload your JSON. As always, avoid pasting live secrets into any website if you can.

Last reviewed by the WordTools Pro team. How our tools work