Logo

JSON Formatter & Validator

Format, validate, minify, and beautify JSON with syntax highlighting

Settings
2

Input JSON

0 chars1 lines

Formatted Output

Click Format or Minify to see output here…

Free JSON Formatter & Validator — Beautify, Minify and Validate JSON Online

JSON (JavaScript Object Notation) is the most widely used data format for APIs, configuration files, and web applications. When you receive raw JSON from an API response or log file, it usually arrives as a single compressed line — unreadable without formatting. A JSON formatter takes that minified data and converts it into a structured, indented, human-readable format in seconds.

The OmniWebKit JSON Formatter does more than just add whitespace. It validates your JSON as you type — showing a green "Valid" badge when the syntax is correct and a red "Invalid" badge with the exact error message when something is wrong. This makes it a JSON validator as well as a formatter. You can adjust the indentation (1–8 spaces), sort object keys alphabetically, strip non-standard JavaScript-style comments, and toggle syntax highlighting that colours keys, strings, numbers, booleans, and null values in distinct colours.

After formatting or minifying, you can copy the output to the clipboard with one click, or download it as a formatted.json file. The Structure Stats panel shows a breakdown of object keys, arrays, strings, numbers, booleans, and null values in the parsed JSON — useful for understanding the shape of your data at a glance.

JSON Formatting Options Explained

Format / Beautify

Parses your JSON and outputs it with indentation, newlines, and spacing. Makes compact API responses and minified config files easy to read and debug.

Minify

Removes all whitespace, newlines, and comments from your JSON, producing the smallest possible valid JSON string. Used to reduce payload size for API responses, localStorage, or config files.

Indentation (1–8)

Controls how many spaces are used per level of nesting. 2 spaces is the most common standard used by JavaScript, Python, and most JSON style guides. 4 spaces is common in languages like C# and Java. Tabs can be simulated at 4 or 8 spaces.

Sort Keys (A–Z)

Sorts all object keys alphabetically at every level of nesting. Useful for comparing two JSON objects (since key order won't differ), creating deterministic output, and making large objects easier to navigate.

Strip Comments

Standard JSON does not support comments. However, some tools (VS Code settings.json, JSON5 files) allow JavaScript-style // line comments and /* block comments */. Enabling this option strips them before parsing so the JSON validates correctly.

Syntax Highlighting

Colours different JSON value types in distinct colours: keys in blue, strings in green, numbers in amber, booleans in violet, and null values in red. Makes structured data much faster to read and understand visually.

Common JSON Errors and How to Fix Them

The validator shows the exact error message from the JSON parser when your input is invalid. Here are the most common JSON errors and what causes them:

Unexpected token

Usually caused by a trailing comma after the last item in an array or object. Example: {"a":1,} — the comma after 1 is not allowed in standard JSON.

Unexpected end of input

The JSON is incomplete. A bracket, brace, or quote is opened but never closed. Check for missing } or ] at the end of the document.

Unexpected token in JSON

Often caused by single quotes instead of double quotes. JSON requires double quotes for all strings and keys. Example: {'name': 'John'} is invalid — must be {"name": "John"}.

Property name must be a string

All JSON object keys must be quoted strings. Unquoted keys (like {name: "John"}) are valid JavaScript but not valid JSON.

Circular reference or too much recursion

Not a JSON parsing error but a serialisation error. Objects that reference themselves (circular references) cannot be serialised to JSON. This would appear in stringify operations, not parse operations.

Frequently Asked Questions

Is this JSON formatter free?+
Yes, completely free with no usage limits, no account required, and no data sent to any server. All processing runs in your browser.
Is my JSON data private?+
Yes. Your JSON is processed entirely in your browser using JavaScript. Nothing you paste is uploaded, stored, or transmitted anywhere.
Why does standard JSON not allow comments?+
JSON was designed as a pure data interchange format. Comments are a documentation feature that adds complexity to parsers. Douglas Crockford (JSON's creator) intentionally excluded them. Use the Strip Comments option if you have JSON5 or JSONC files with comments.
What is the difference between JSON and JSONC?+
JSONC (JSON with Comments) is an extension used by VS Code for configuration files. It supports // and /* */ comments. Standard JSON parsers reject these — use the "Strip Comments" option before formatting JSONC files.
What does "Sort Keys" do exactly?+
It recursively sorts all object keys alphabetically at every nesting level. This makes JSON objects deterministic and easier to compare or diff, since the key order won't vary between two otherwise identical objects.
Can I use this to format large JSON files?+
Yes, but very large files (several megabytes) may be slow to format in the browser. For very large files, command-line tools like `jq` are more efficient. For typical API responses and config files, this tool handles them without issue.
What do the colour codes in syntax highlighting mean?+
Blue = object keys, Green = string values, Amber = numbers, Violet = booleans (true/false), Red = null values. Punctuation (braces, brackets, colons) remains in the default text colour.
Can I download the formatted JSON?+
Yes. After formatting or minifying, click the "Save .json" button to download the result as a file named "formatted.json".
Advertisement
Logo

Your all-in-one digital toolkit with 100+ free online tools. Fast, secure, and always available when you need them.

Secure & Private

All processing happens locally in your browser

Mobile Friendly

Works perfectly on all devices and screen sizes

Always Free

No registration, no limits, completely free to use

100+
Free Tools
50K+
Daily Users
1M+
Tools Used
150+
Countries
© 2026 OmniWebKit. All rights reserved.
Made withfor developers and creators