{"name":"Alice","age":30,"active":true}
{
"name": "Alice",
"age": 30,
"active": true
}
A flat JSON object is expanded with 2-space indentation for easy reading.
Format, validate, inspect, sort and minify JSON online. Paste raw, compact or broken JSON to pretty-print it with 2 spaces, 4 spaces, or tab indentation, switch between highlighted text and collapsible tree view, detect duplicate keys, view structure stats, sort object keys alphabetically, download the result, or compact JSON for production use. Everything runs locally in your browser.
{"name":"Alice","age":30,"active":true}
{
"name": "Alice",
"age": 30,
"active": true
}
A flat JSON object is expanded with 2-space indentation for easy reading.
[{"id":1,"role":"admin"},{"id":2,"role":"user"}]
[
{
"id": 1,
"role": "admin"
},
{
"id": 2,
"role": "user"
}
]
A JSON array of objects is formatted with nested indentation.
{
"key": "value",
"count": 42
}
{"key":"value","count":42}
Formatted JSON is compacted into a single line by removing all whitespace.
{"status":"ok","data":{"items":[{"id":101,"tags":["json","api"]},{"id":102,"tags":[]}],"next":null}}
{
"status": "ok",
"data": {
"items": [
{
"id": 101,
"tags": [
"json",
"api"
]
},
{
"id": 102,
"tags": []
}
],
"next": null
}
}
A nested API-style payload is pretty-printed so objects, arrays and null values are easier to inspect.
JSON (JavaScript Object Notation) is a lightweight data-interchange format used by APIs, configuration files, logs, web apps, build tools and data exports. It is easy for machines to parse, but minified JSON or deeply nested API responses can be difficult for people to read.
This online JSON formatter, also called a JSON beautifier or pretty printer, parses the raw JSON text, validates it for syntax correctness, and serialises it back with consistent indentation. You can choose 2 spaces, 4 spaces, or tab indentation, then inspect the result as highlighted text or as a collapsible tree.
Formatting (the Format tab) makes JSON human-readable by expanding objects and arrays onto separate lines and adding indentation. Use it when debugging API responses, reviewing webhook payloads, checking frontend state, comparing configuration files, or understanding nested data before copying it into code.
Minification (the Minify tab) removes unnecessary whitespace and line breaks, producing a compact one-line JSON string. Use it when embedding JSON in source code, storing payloads in environment variables, sending test requests, or reducing transfer size. The values remain the same; only the whitespace changes.
JSON supports exactly six value types:
\", \, \/, \n, \r, \t, \uXXXX. Example: "Hello, world!"Infinity, and NaN are not allowed. Example: 42, -3.14, 1.5e10true or false (lowercase only).null (lowercase only), representing the absence of a value.{}. Keys must be strings. Example: {"name": "Alice", "age": 30}[]. Values may be of any JSON type and may be mixed. Example: [1, "two", true, null]A few rules that frequently cause JSON validation errors:
{"a": 1,} and [1, 2,] are invalid. The last element in an object or array must not be followed by a comma.// line or /* block */ comments. Strip them before parsing."double quotes". Single quotes (') and backticks are not allowed.undefined, NaN, Infinity, and functions cannot be represented in JSON.The validator runs before any output is produced. If the input is not valid JSON, the tool shows the parser error and, when the browser provides enough information, highlights the approximate line and column in the source text. This is useful for quickly finding missing commas, invalid quotes, unescaped control characters, truncated arrays, or malformed numbers.
Because the formatter uses the browser's native JSON parser, it follows strict JSON syntax rather than JavaScript object literal syntax. A value such as {name: 'Alice'} may look familiar in JavaScript, but it is not valid JSON because the key and string value must use double quotes.
After a successful format operation, the output includes a highlighted text view and a collapsible tree view. The tree view is helpful for exploring deeply nested objects and arrays without losing your place, while the text view is better for copying formatted JSON into an editor, issue tracker, documentation page, or API client.
The tool also calculates structure statistics: number of objects, arrays, keys, maximum depth, characters and bytes. These quick metrics help estimate payload size, spot unexpectedly deep nesting, and understand whether a response is mostly object metadata, list data, or a mixed structure.
The Sort Keys action alphabetically sorts object keys recursively while keeping array order unchanged. This can make configuration files easier to scan, reduce visual noise in code reviews, and make two JSON documents easier to compare after formatting.
The Download action saves the current JSON result as a file, so you can keep a cleaned payload, share a reproducible example, or archive a minified configuration without copying from the browser manually.
Encode text and binary payloads to Base64 and decode them back with UTF-8 support.
Convert text and bytes to hexadecimal format and decode hex sequences back to text.
Encode and decode URL strings and query params for safe transport in HTTP and APIs.
Convert text into 8-bit binary groups and decode binary bytes back into readable text.
Convert ASCII characters and numeric codes for protocol and parser workflows.
Decode JWT tokens in-browser and inspect header, payload, claims, and expiration data.