JSON Prettier
Format, minify and validate JSON in the browser, with the parser's own error message when it will not parse.
JSON Prettier & Validator
Format and validate your JSON data.
What JSON Prettier does
APIs send JSON without whitespace to save bandwidth, which makes a response impossible to read by eye. This tool re-indents it with two spaces so the structure is visible, and reverses the process when you need a compact string again.
It also acts as a validator. JSON has a strict specification, and a document that looks fine to a human is often rejected for one specific reason. When parsing fails, the message you get is the browser's own parser error, including the position where it gave up, rather than a generic failure notice.
- Re-indent minified JSON with two-space indentation
- Minify formatted JSON back to a single line
- Validate against the strict JSON specification as you type
- Copy the result to the clipboard in one click
How to use JSON Prettier
- 1
Paste your JSON
Drop the raw response, log line or configuration file into the editor. It works with a single value, an object, or a top-level array.
- 2
Format or minify
Use Prettify to expand the document with indentation, or Minify to strip whitespace back out. The editor is transformed in place.
- 3
Read the validation status
If parsing fails, the error names the problem and where it occurred. Fix that position and the status clears.
- 4
Copy the result
The copy button places the current contents of the editor on your clipboard.
Example
A minified response expanded for reading
Input
{"id":42,"name":"Ada","roles":["admin","editor"],"active":true}Output
{
"id": 42,
"name": "Ada",
"roles": [
"admin",
"editor"
],
"active": true
}When to use it
Reading a log line
Server logs record request and response bodies as one long string. Formatting makes the nesting visible so you can find the field that is wrong.
Checking a config file before deploying
A trailing comma in a JSON config is a syntax error that some tools report only as a startup failure. Validating first tells you exactly where it is.
Shrinking a payload
Minifying removes the whitespace added for readability before you paste a value into an environment variable or a request body.
Limits and known behaviour
- Indentation is fixed at two spaces. There is no option for four spaces or tabs.
- Formatting and minifying replace the contents of the editor rather than writing to a second pane, so keep a copy of the original if you still need it.
- Validation follows the strict JSON specification: comments, trailing commas, single-quoted strings, unquoted keys, NaN and Infinity are all errors. JSON5 and JSONC are not supported.
- Numbers pass through JavaScript's number type. An integer beyond 2^53 loses precision when it is re-serialised, so 64-bit identifiers should be transported as strings.
- Duplicate keys are not reported. The specification does not forbid them, and the parser keeps the last one.
- Very large documents, in the region of tens of megabytes, will make the editor sluggish because the whole string is held in the page.
Privacy and data handling
Runs entirely in your browser
- Your input is processed by JavaScript running in this page. The tool sends no request anywhere, so nothing you paste is transmitted or logged by this site.
- That matters here more than for most utilities: pasted JSON often contains customer records, tokens or connection strings.
- Nothing is saved between visits. Closing or reloading the tab discards whatever is in the fields.
Site-wide data handling, including analytics and advertising, is described in the privacy policy.
Frequently asked questions
Why is my JSON invalid when it looks correct?
The usual causes are a trailing comma after the last item, single quotes instead of double quotes, an unquoted key, or a comment. All four are valid JavaScript but not valid JSON. The error message points at the character where the parser stopped, which is usually just after the real mistake.
Can it repair broken JSON automatically?
No, and deliberately so. Repairing malformed JSON means guessing what was intended, and a wrong guess produces a document that parses but no longer means what it did. The tool reports the problem and leaves the correction to you.
Is it safe to paste a production response here?
The text is parsed by JavaScript in your own browser and is never sent to a server, so it is not transmitted or stored by this site. If it contains a live credential, treat it as exposed to your own machine's clipboard history and rotate it if that matters.
Does it change my numbers?
Only beyond JavaScript's safe integer range. Values above 9,007,199,254,740,991 are rounded when parsed, so a large numeric ID can come back different from what you pasted.