📋
JSON Formatter & Validator
Format, minify, validate and fix JSON — tree view, file open and download
Ctrl+Enter = format
Result appears here

JSON Formatter, Validator & Minifier

Free online JSON formatter and validator. Beautify minified JSON or minify formatted JSON instantly. Syntax errors show the line and column where parsing failed, and common mistakes can be fixed in one click.

Free No login 100% browser-based Your input never leaves your device

Try these next

What is a JSON Formatter & Validator?

JSON (JavaScript Object Notation) is the de-facto data interchange format for APIs, config files, and web services. Raw JSON from APIs is often minified — no whitespace, hard to read. This formatter beautifies JSON with proper indentation and syntax highlighting, and validates it at the same time, showing the line and column of the first syntax error.

Everything runs in your browser using the native JSON.parse() engine. No data is ever sent to a server. Supports JSON objects, arrays, strings, numbers, booleans, and null values.

How to format and validate JSON

1. Paste your JSON into the input field, or open or drop a .json file. 2. Choose Format for indented output, or Minify to remove all whitespace. Tick Sort keys to order object keys alphabetically. 3. If there's a syntax error, the tool points to the line and column where parsing failed. If the cause is a common mistake, click Fix it to repair it. 4. Switch to Tree to browse large documents, then Copy or Download the result.

Common JSON syntax rules

Keys must be in double quotes (not single quotes). No trailing commas after the last item in an array or object. Strings must escape special characters: use \n for newline, \\ for backslash, \" for quotes. Numbers, booleans (true/false), null, arrays, and objects are all valid JSON values. The root element can be an object, array, string, number, or boolean.

What causes 'Invalid JSON' errors?
Common causes: trailing commas after the last item, single quotes instead of double quotes, unquoted property keys, and JavaScript-specific values like undefined or NaN which are not valid JSON.
What's the difference between Beautify and Minify?
Beautify adds indentation and line breaks for readability — use this when debugging APIs or reading config files. Minify removes all whitespace to reduce file size — use this for production JSON payloads.
Is this JSON formatter safe for sensitive data?
Yes. All processing happens entirely in your browser using JavaScript. Your JSON is never sent to any server.
How do I find the exact line causing a JSON error?
This tool shows the line and column of the first syntax error, with a pointer under the problem character (Chrome, Edge and Firefox; Safari only gives the error message). Common issues: trailing commas after the last item in an object or array (not allowed in JSON), single quotes instead of double quotes, unescaped special characters in strings, and missing commas between key-value pairs.
What's the difference between JSON and JSON5?
JSON5 is a superset of JSON that allows comments, trailing commas, single quotes, and unquoted keys. It's human-friendly for config files but not supported by standard JSON parsers. Most APIs use strict JSON. If you're editing a config file like .eslintrc or tsconfig, it may accept JSON5 or JSONC (JSON with Comments).
How large a JSON file can I format?
Files up to 50 MB. Drop a file on the input box or use Open file; it is read and formatted in your browser and never uploaded. Very large documents can take a few seconds to format and display, and the tree view is fastest when you collapse what you don't need.
What is JSON minification used for?
Minified JSON removes all whitespace and newlines, reducing file size by 20–40%. This is useful for API responses (smaller payload = faster transfer), storing JSON in databases (less storage), and embedding JSON in source code. Keep the beautified version in version control so changes are easy to review, and minify when you ship.
Can this tool fix invalid JSON automatically?
Yes, for the most common mistakes: trailing commas, // and /* */ comments, single-quoted strings, unquoted keys, Python True/False/None, and JavaScript undefined or NaN. When it finds them, a Fix it button appears and rewrites your input as valid JSON. Other errors, such as a missing bracket, still need a manual fix — the line and column pointer shows where to look.
✓ Copied!