← Back to tools
DeveloperStudentGeneraldevtoolsutilities

JSON Formatter & Validator

Format, validate, and minify JSON instantly with clear error messages, line and column numbers, and one-click copy or download.

Paste any JSON — from an API response, config file, or log export — and format it for reading, minify it for transport, or validate it to find exactly where the syntax breaks. Clear error messages, line and column numbers, one-click copy. Everything runs locally.

JSON Formatter & Validator

Paste JSON on the left, pick an action, and inspect the result on the right.

About this tool

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It is language-independent but uses conventions familiar from C-family languages, making it easy to read and write for humans and trivial to parse and generate for machines. Today it is the dominant format for web APIs, configuration files, database exports, and inter-service communication.

A valid JSON value is one of: an object (key-value pairs wrapped in curly braces), an array (ordered list wrapped in square brackets), a string (double-quoted), a number, a boolean (true or false), or null.

Format vs Minify vs Validate — what is the difference?

Format (Prettify)
Takes compact or messy JSON and rewrites it with consistent indentation and line breaks. The result is easy to read in an editor, review in a pull request, or paste into documentation. The data is not changed — only the whitespace.
Minify
Strips all unnecessary whitespace and produces a single-line version. Useful for embedding JSON inside code strings, reducing payload size in HTTP requests, or fitting data into systems that do not expect line breaks. Again, only whitespace is removed — the data is identical.
Validate
Checks whether the input is syntactically valid JSON according to the ECMA-404 / RFC 8259 specification. If it is valid, you see a green confirmation. If not, you see the parser error and — where possible — the line and column where the problem was found.

Common JSON syntax errors and how to fix them

Trailing comma

{ "name": "Alex", }

JSON does not allow a comma after the last element. Remove the trailing comma: { "name": "Alex" }

Single quotes instead of double quotes

{ 'name': 'Alex' }

JSON requires double quotes for both keys and string values. Replace all single quotes with double quotes.

Unquoted property name

{ name: "Alex" }

Every key in a JSON object must be a double-quoted string: { "name": "Alex" }

Comments in JSON

{ "name": "Alex" // admin }

JSON does not support comments. Remove the comment entirely, or move the note outside the JSON payload.

Unmatched or missing bracket / brace

{ "items": [1, 2, 3 }

Every opening bracket [ or brace { must have a matching closing bracket ] or brace }. Count your nesting levels carefully.

Undefined or NaN as a value

{ "score": NaN }

JSON only supports numbers, strings, booleans, null, objects, and arrays. Replace NaN or Infinity with null or a valid number.

How indentation is chosen

The formatter supports three indent styles. Two spaces is the most common choice in JavaScript and TypeScript codebases. Four spaces is common in Python, Java, and many style guides. Tabs are preferred in some codebases for accessibility reasons (screen readers and editors can render tab width independently). Choose the style that matches your project or the system you are pasting into.

Privacy and security

All JSON processing happens entirely in your browser using the native JSON.parse and JSON.stringify APIs that ship in every modern JavaScript engine. Your data is never sent to a server, never logged, and never stored. This makes the tool safe for use with internal API payloads, customer data, credentials, or any content you would not want to pass through a third-party service.

Frequently asked questions

Can I format very large JSON files?

Yes. All processing is synchronous JavaScript. Files up to a few megabytes typically format in well under a second. Very large payloads (10 MB+) may take a moment depending on your device, but there is no hard limit imposed by the tool.

Does formatting change my data in any way?

No. Format and Minify only alter whitespace. The parse-then-stringify round-trip preserves all values exactly, including numbers, booleans, null, nested objects, and arrays. The only exception is that key order within objects may be normalised to the order the JavaScript engine encountered them — which for most cases is the original order.

Why does the error say 'at position X' instead of a line number?

The native V8 JavaScript engine (used in Chrome, Node.js, and Edge) reports errors by character offset. This tool converts that offset into a line and column number automatically, so you should always see a human-readable location. Firefox reports line and column directly.

What is the difference between JSON and JSON5 or JSONC?

Standard JSON (RFC 8259) does not allow comments, trailing commas, or single-quoted strings. JSON5 and JSONC (JSON with Comments) are supersets that add these features. This tool validates and formats standard JSON only. If your input uses JSON5 or JSONC features, you will need to strip those additions first.

Can I use this for JSON inside environment variables or dotenv files?

Yes. A common pattern is to store a JSON object as a string inside an environment variable. You can paste the value here to validate and format it, then minify it for pasting back into the variable value.

Does the tool support JSON arrays at the root level?

Yes. A root-level JSON array — for example a list of objects — is fully valid JSON and is handled correctly by all three operations: Format, Minify, and Validate.