Loading tool…
About the JSON Formatter
Paste any JSON payload — an API response, a config blob, a log line — and get it pretty-printed with consistent indentation. Runs entirely client-side, so nothing you paste is ever uploaded.
How to use the JSON Formatter
- Paste or type your JSON into the input box.
- Click Format to pretty-print it, or Minify to strip whitespace.
- Invalid JSON is flagged with the line and column of the syntax error.
- Copy the result or download it as a .json file.
Step-by-step walkthrough with examples and the errors people hit: How to Format and Validate JSON Online.
Example
Minified input
{"user":{"id":1,"name":"Ada","active":true}}
→
{
"user": {
"id": 1,
"name": "Ada",
"active": true
}
}
Common errors and how to fix them
Expected double-quoted property name
Reported at a closing brace, this is a trailing comma after the last property: JSON does not allow it, even though JavaScript does. Reported at a key, the key is unquoted or single-quoted; wrap it in double quotes.
Expected property name or '}'
The first key in an object is unquoted or single-quoted, or a comment sits at the start of the object. {name: "Ada"} and {'name': "Ada"} are both invalid; {"name": "Ada"} is correct.
More problems and fixes in the tutorial
Format, validate and minify in one place
Paste JSON and press Format to pretty-print it with two-space indentation and one key per line, or Minify to strip every byte of whitespace before it goes into a query string, an environment variable or a database column. Both operations start by parsing, so the same click validates the document: if it is not valid JSON you get the parser's message with the exact line and column instead of half-formatted output.
How the validation works
The formatter uses the JSON parser built into your browser, the same one that runs when a web application calls JSON.parse. That matters for two reasons: the error messages match what your own code will report, and there is no server involved, so a 40 MB export formats as quickly as your machine allows. Errors quote the position of the first problem; fix it, format again, and the next problem, if any, moves into view.
The usual culprits are a trailing comma after the last item, single quotes instead of double quotes, an unquoted key, a comment, or two documents pasted one after another. The tutorial linked above walks through each message and its fix.
When a JSON formatter earns its keep
API responses copied from a network tab or a curl call arrive minified. Structured logs embed JSON inside a text line. Configuration files such as package.json, tsconfig.json and composer.json get hand-edited until something breaks. In all three cases, formatting turns a blur into a structure you can read, and validation tells you whether the blur was ever valid at all. Formatting before you commit also produces clean diffs for reviewers.
Formatter, beautifier, viewer or validator?
The words are used interchangeably. A formatter or beautifier re-indents; a validator checks syntax and reports errors; a viewer adds a collapsible tree. This tool formats, validates and minifies. For comparing two documents structurally, use JSON Diff; for converting to YAML or CSV, the converters are one click away in the related tools.
Privacy and limits
Nothing you paste is uploaded. Parsing and formatting happen in the page, which is why the tool is safe for payloads that contain customer data or tokens. There is no server-side size limit; very large documents are limited only by your browser's memory. Keyboard: Ctrl+Enter formats, and Full screen gives the panes the whole window.
FAQ
Is my JSON uploaded to a server?
No. Formatting and validation run entirely in your browser using the JSON parser built into JavaScript. Nothing is sent over the network.
What happens with invalid JSON?
The tool reports the parse error along with its approximate line and column so you can find the problem quickly.
Is there a size limit?
It runs in your browser tab, so very large files (tens of MB) may be slow depending on your device — but there is no server-side limit.
Can I format JSON with 4 spaces or tabs?
This formatter uses two spaces, the most common convention in JavaScript projects. If your project standard is four spaces or tabs, format here to validate, then let your editor's formatter apply its indentation on save.
Does the formatter change key order or values?
No. Keys stay in their original order and values are untouched; only insignificant whitespace is added or removed. Numbers are re-serialised by the parser, so 1.0 becomes 1, which is the same value in JSON.
Can it fix invalid JSON automatically?
No, and tools that claim to guess. It shows you exactly where parsing stopped so you can fix the source, which is safer than a silent rewrite of data you did not intend.
Is there a keyboard shortcut?
Ctrl+Enter (Cmd+Enter on a Mac) runs Format. Esc leaves full-screen mode.