Runs in your browser. Nothing you enter is uploaded or stored.
To format, validate or minify JSON, paste it into the free JSON Formatter and Validator above and press Format. It pretty-prints the data with clean indentation, tells you the exact line and column of any syntax error, can sort keys alphabetically, minify the output, and repair common mistakes such as comments, trailing commas, unquoted keys and single quotes. If the data contains JSON-LD, it also checks for @context and @type. Paste several documents separated by a line of equals signs and it checks up to 200 at once.
Last updated: 11 November 2026. Written by Saad Raza.
Key takeaways
- JSON is strict. One trailing comma, one single quote or one missing bracket makes the whole document invalid, and parsers either fail or silently ignore the data.
- For SEO, the main place JSON appears is structured data: JSON-LD blocks that describe your business, products, articles and FAQs to search engines. A syntax error there means no rich result.
- A formatter makes data readable, a validator proves it is parseable, and a minifier removes whitespace to cut file size. This tool does all three.
- Valid JSON is not the same as valid schema. After the syntax is correct, check the vocabulary with a schema validator.
- Everything runs in your browser. API responses and configuration with private values are not uploaded.
What JSON is and why it breaks
JSON is a plain-text format for structured data: objects in curly braces with named keys, arrays in square brackets, and values that are strings, numbers, true, false or null. It is the language of APIs, configuration files, tag managers and structured data. Its rules are few but unforgiving. Keys and strings must use double quotes. There are no comments. The last item in an object or array must not be followed by a comma. Numbers cannot have leading zeros, and the values undefined, NaN and functions do not exist.
People break these rules constantly, usually because they copy from JavaScript, where the rules are looser, or edit by hand. A JSON-LD block pasted from a blog post may contain curly quotes added by a word processor. A configuration file edited late at night may have a trailing comma. The error message from a parser is often unhelpful, such as “unexpected token”, with no hint of where. This tool shows the line and column and the character it did not expect.
How to use the JSON Formatter and Validator
- Paste your JSON into the box.
- Choose an action: Format to indent, Minify to remove whitespace, or Validate to check only.
- Choose the indentation (two spaces, four spaces or a tab) and tick Sort keys if you want them in alphabetical order, which makes two versions easier to compare.
- Tick Try to repair if the data is not valid. The tool fixes what it safely can and lists each change it made.
- Press Run. If the JSON is valid you see statistics: the number of keys, the nesting depth, the number of arrays and the size before and after. If it is invalid you see the error with its position.
- To check many documents, separate them with a line containing only =====, and each one is reported on its own.
What the repair option fixes
| Problem | Example | Fix applied |
|---|---|---|
| Comments | // note or /* note */ | Removed |
| Trailing commas | {“a”: 1,} | Comma removed |
| Unquoted keys | {name: “Saad”} | Key wrapped in double quotes |
| Single quotes | {‘a’: ‘b’} | Changed to double quotes |
Repair is deliberately conservative. It does not guess missing brackets or invent values, because a wrong guess can change the meaning of your data. If the document is still invalid after the safe fixes, you get the remaining error to fix by hand. Always read the repaired output before you use it.
A worked example
The example is a LocalBusiness block in JSON-LD with a name, address, opening hours and a list of services. It is valid, so the tool shows it formatted with two-space indentation and reports 8 keys, a nesting depth of 3, 1 array, and a size that falls from 250 to 220 characters once whitespace is removed. The 30-character difference is only whitespace, and it shows what minifying saves on a tiny block. On a large document the saving is bigger.
Now imagine the same block with a trailing comma after the last property and a comment above it. A strict parser rejects it. With repair on, the tool removes the comment and the comma, lists “Removed comments” and “Removed trailing commas”, and returns clean JSON. Without repair, you would see an error pointing at the line and column of the comma. Both outputs are useful: the first gets you moving, and the second shows exactly where your editor or template went wrong.
JSON and structured data for SEO
Google recommends JSON-LD for structured data. It sits in a script tag in the page, so any syntax error in it is invisible to visitors but fatal to the markup. Typical causes are a curly quote from a text editor, a comma left in after deleting a property, an unescaped double quote inside a description, or a template that outputs an empty value. When the block fails to parse, Search Console reports a structured data error or simply shows no enhancement at all.
When the data contains an @context or @type, this tool adds hints: it checks that @context points to schema.org and that every typed object has an @type, which are the two most common omissions. It does not know every schema type or property. For that second layer, run the block through the JSON-LD validator, which checks required and recommended properties. If you do not have a block yet, the schema generator builds one for you from a form.
Other places you will meet JSON
- APIs. Responses from analytics, search and marketing platforms are JSON. Formatting a response makes it readable and shows which fields exist.
- Tag managers and data layers. Custom event data and variables are JSON-like. A syntax error can stop a tag from firing and lose conversion data. Pair this with the UTM bulk builder when you tidy campaign tracking.
- Configuration files. Build tools, site settings and plugins often use JSON. Validate before you deploy.
- Encoded data. If a string looks like random letters, it may be Base64 of a JSON document. Decode it with the Base64 encoder and decoder and paste the result here. Values inside URLs may need the URL encoder and decoder first.
- Web app manifests and feeds. Manifests, product feeds and some sitemaps-like files are JSON and are read by machines that do not forgive errors.
Tips for clean JSON
Escape double quotes inside strings with a backslash, and write line breaks inside strings as n, because a real line break is not allowed. Use a period for decimals, with no thousands separators. Keep dates as strings in a consistent format such as 2026-11-11. Use null for a missing value rather than an empty string if the receiver distinguishes them. Keep keys consistent in case and spelling. And do not hand-edit large documents when you can generate them: a small template error repeats on every page. If your site’s structured data is generated by a plugin or a theme and keeps failing, an SEO audit can trace which template is at fault.
Limits
The tool checks syntax against the JSON standard. It does not check data against a schema, so a value of the wrong type for your purpose is still valid JSON. Repair handles the four common problems listed above and nothing more. Very large documents, tens of megabytes, may slow the browser, and numbers beyond the safe integer range of JavaScript lose precision when parsed, so do not use the formatter to check large identifiers. In bulk mode the limit is 200 documents per run. Everything is processed in your browser, and nothing is sent to a server.
Questions about the JSON Formatter and Validator
Why is my JSON invalid?
The most common reasons are a trailing comma, single quotes instead of double quotes, an unquoted key, a comment, or a missing bracket. The tool shows the line and column of the first error so you can find it quickly.
Can JSON have comments?
No. The standard does not allow them. Use the repair option to strip them, or keep notes in a separate field of the data.
What is the difference between formatting and minifying?
Formatting adds indentation and line breaks for people to read. Minifying removes them to make the file smaller for machines. The data is identical either way.
Does valid JSON mean valid structured data?
No. Valid JSON only means the syntax is correct. The properties and types still have to follow schema.org and the search engine’s requirements, which a schema validator checks.
Is my data sent anywhere?
No. The tool works in your browser, so API responses and configuration stay on your device.
If you want help getting structured data right across a whole site, see my SEO services or ask for a free audit. You can also browse the other free technical SEO tools.
Request received
Thank you! Saad will contact you within the next 24 hours.
Keep an eye on your phone and inbox.
