JSON Formatter & Validator
Paste JSON to beautify, validate or minify it. Errors are shown with their line and column, and common mistakes can be fixed in one click.
Your JSON is processed in your browser and never uploaded.
Related Developer Tools
This JSON formatter and validator makes JSON readable, checks that it is valid, and minifies it when you need it small. Paste an API response, a config file or a log line and it is pretty-printed as you type. If the JSON is broken you see exactly where: the line, the column and a marker under the character that stopped the parser. Common mistakes copied from JavaScript or Python, such as trailing commas, comments and single quotes, can be fixed with one click.
How to Use the JSON Formatter
- Paste JSON or open a
.jsonfile. - Choose Beautify or Minify. For Beautify, pick 2 spaces, 4 spaces or tabs; turn on Sort keys to order every object alphabetically.
- Read the status bar. It confirms valid JSON with the number of keys, how deeply it is nested and the size before and after, or points to the first error.
- Copy or download the result as a
.jsonfile.
Common JSON Errors and How to Fix Them
| Invalid | Valid | Problem |
|---|---|---|
{"a": 1,} | {"a": 1} | Trailing comma after the last item |
{name: "Ali"} | {"name": "Ali"} | Keys must be in double quotes |
{'name': 'Ali'} | {"name": "Ali"} | Strings must use double quotes |
{"a": 1 // note} | {"a": 1} | JSON has no comments |
{"a": 1 "b": 2} | {"a": 1, "b": 2} | Missing comma between items |
{"ok": True} | {"ok": true} | true, false and null are lowercase |
{"n": NaN} | {"n": null} | NaN and Infinity are not allowed |
Beautify or Minify?
Beautified JSON, with each value on its own line, is for reading, reviewing and committing to version control, where one changed value shows up as one changed line. Minified JSON removes every space and line break that is not inside a string. It is the same data in fewer bytes (the status bar shows how many), and suits request bodies, environment variables and anything stored in a single line. Only the spacing changes: numbers and strings are copied exactly as you wrote them, so 120000.00 stays 120000.00 and an escaped \u00e9 stays escaped.
JSON Rules in Short
- A value is an object
{}, an array[], a string in double quotes, a number,true,falseornull. - Numbers are plain decimals: no leading
+, no leading zeros such as007, no hex. - Inside strings, a double quote, backslash and control characters such as a line break must be escaped (
\",\\,\n). - Duplicate keys are allowed by the syntax, but most parsers keep only the last one, so avoid them.
Related Tools
To open JSON data in Excel or Google Sheets, convert it with the JSON to CSV converter. Working on a front end? The HEX to OKLCH converter and contrast checker are in the same set of developer tools.
Frequently Asked Questions
How do I format JSON?
Paste it into the left box. The formatted version appears on the right as you type, indented with 2 spaces by default. Choose 4 spaces or tabs, or switch to Minify for the most compact form.
How do I know if my JSON is valid?
A green Valid JSON bar appears below the boxes when it parses. If it does not, a red bar shows the line and column of the first error, the line itself with a marker under the problem, and what the parser expected there.
What are the most common JSON errors?
A comma after the last item in an object or array, keys without double quotes, strings in single quotes, comments, and missing commas between items. JSON also does not allow NaN, Infinity, undefined or functions.
What does Fix automatically do?
It rewrites JavaScript-style JSON as standard JSON: it removes // and /* */ comments and trailing commas, changes single-quoted strings to double-quoted ones, puts double quotes around bare keys, and turns Python's True, False and None into true, false and null. The button only appears when that is enough to make the JSON valid. Text inside strings is never changed.
Does sorting keys change my data?
No. Objects in JSON have no meaningful key order, so sorting only changes how it reads. Arrays keep their order. Sorting is useful for comparing two JSON files or keeping config files tidy.
Will formatting change my numbers?
No. Many formatters run JSON through JavaScript, which rewrites 120000.00 as 120000 and rounds whole numbers longer than 16 digits, such as 64-bit IDs, so 12345678901234567890 becomes 12345678901234567000. This one only re-spaces the text you pasted, so every number keeps its exact digits.
Can I load JSON from a file or a URL?
Yes. Use Open file, drag a .json file onto the box, or press From URL and paste an address such as an API endpoint or a raw GitHub file. Your browser fetches the URL directly, so it works only with sites that allow it (most public APIs do); for others, download the file and open it instead.
What about JSON Lines (NDJSON) files?
A file with one JSON value per line, common for logs and data exports, is recognised: the tool offers to wrap the lines in an array so the whole file becomes one valid JSON document.
Is there a size limit?
Files up to 100 MB can be opened. Formatting a 6 MB file takes a second or two. For very large results only the start is shown in the box so the page stays responsive; Copy and Download always give the full output. JSON nested more than 1,000 levels deep is reported rather than formatted.
Is my JSON uploaded or saved?
No. It is parsed by your browser and never leaves your device, so it is safe to paste API responses, tokens or customer data. Nothing is stored after you close the page.