Online JSON Formatter

Format, validate and explore your JSON instantly. Everything happens in your browser.

Input
Output
Paste your JSON here...

What is JSON?

JSON (JavaScript Object Notation) is a lightweight text-based data format, standardized as RFC 8259 and ECMA-404, used for exchanging data between servers and web applications. It is human-readable and easy for machines to parse. Its simplicity has made it the de facto standard for REST APIs, configuration files, and structured data storage.

A JSON document consists of two structures: objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets). Values can be strings, numbers, booleans, null, or nested objects and arrays. The syntax is strict: keys must be in double quotes, and trailing commas are not allowed.

Formatting (or beautifying) JSON adds indentation and line breaks for readability. Minifying does the opposite: removing unnecessary whitespace to reduce file size. Both operations are reversible and do not modify the data.

How to format JSON with this tool

  1. Paste or load your JSON

    Copy JSON from your editor, terminal, or an API response, then paste it into the left-hand panel. You can also click "Paste" to pull directly from your clipboard, or "Sample" to load a demo JSON and try the tool without your own data at hand.

  2. Let validation run automatically

    As soon as you type or paste, the tool attempts to parse the text. A green indicator confirms valid JSON; a red one shows the exact error message returned by the JavaScript engine, including the position of the offending character, so you can pinpoint the problem without scanning the whole document by eye.

  3. Format or minify depending on your need

    The "Format" button re-indents the JSON with two spaces per level, making it readable in a code review or in documentation. "Minify" does the opposite: it strips every unnecessary space and line break to shrink the payload. Both operations are reversible and never change the underlying data.

  4. Switch between text and tree view

    "Raw" view shows syntax-highlighted JSON (keys, strings, numbers, booleans). "Tree view" turns it into a collapsible tree, useful for navigating a deeply nested document without getting lost in indentation levels.

  5. Copy the result

    Once the JSON is formatted or minified, "Copy" places the result on your clipboard. "Clear" empties both panels to start over. None of these actions ever touch a server — everything stays inside the browser tab.

Common JSON errors

JSON's syntax is deliberately strict, which makes it reliable to parse but leaves little room for typos. Here are the most common mistakes this tool's validator catches.

Trailing comma

{ "a": 1, "b": 2, }

Unlike JavaScript, JSON never allows a comma after the last item of an object or array. It's the most common mistake when editing JSON by hand.

Single quotes

{ 'a': 1 }

JSON requires double quotes for keys and strings. Single quotes are never accepted, even if your programming language allows them.

Unquoted keys

{ a: 1 }

Unlike a JavaScript object literal, a JSON key must always be a double-quoted string.

Comments

{ "a": 1 } // comment

The JSON specification has no comment syntax at all, even though that's a common need in configuration files.

Malformed numbers

{ "a": 01 }

A JSON number can't start with a zero followed by another digit, and can't start or end with a bare decimal point (.5 or 1. are invalid).

Undefined values

{ "a": undefined }

JSON only has null to represent absence of value. undefined and NaN are JavaScript concepts with no equivalent in the JSON specification.

Frequently asked questions

Is the JSON I paste sent to a server?

No. All processing, parsing, formatting, minifying and validation, runs exclusively in your browser using the native JSON.parse and JSON.stringify JavaScript functions. No data is transmitted to a server, which makes the tool usable even with sensitive data.

What's the difference between formatting and minifying?

Formatting adds indentation and line breaks to make JSON readable by a human. Minifying strips all unnecessary whitespace to reduce file size, which is useful before sending data over the network. Both operations are reversible: they never change the structure or the values.

Is the tool free and unlimited?

Yes, the tool is completely free, requires no account, and has no usage limit. Since all processing happens locally in the browser, the maximum JSON size depends only on your device's available memory, not on a server-side quota.

Does JSON support comments?

No. The JSON specification (RFC 8259) defines no comment syntax. If your configuration file needs comments, formats like JSON5, JSONC, or YAML are alternatives, but they are not strict JSON.

What's the difference between JSON and a JavaScript object?

A JavaScript object literal allows unquoted keys, single quotes, comments, functions, and values like undefined. JSON is a much stricter subset: keys always in double quotes, no functions, no comments, and only string, number, boolean, null, object, and array types.

Why is my JSON valid elsewhere but rejected here?

Some tools (code editors, custom serialization, certain APIs) sometimes produce JSON5 or a near-JSON format that isn't strict. This tool enforces the strict JSON standard: if a document has a trailing comma, a comment, or an unquoted key, it will be flagged as invalid even if the tool that generated it accepted it.