JSON Formatter & Validator
Format, validate, minify, and beautify JSON with syntax highlighting
Input JSON
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.
