JSON Formatter & Validator
Paste any JSON to format it with proper indentation, validate syntax, and minify. Instant error highlighting. Useful for structured data, API responses, and configuration files.
How to use this tool3 quick steps
Copy your JSON
From an API response, a config file, browser DevTools Network tab, or anywhere — paste compressed or pretty-printed, both work.Pick an action
Format = pretty-print with indentation. Minify = strip whitespace. Validate = parse and report any syntax errors with line numbers.Copy the result
One-click copy to clipboard. Use Format for readable output, Minify for production payloads.
Indent
Use this with
Related dev utilities tools
JSON Guide
JSON: the data format powering structured data and APIs
JSON (JavaScript Object Notation) is the universal data interchange format for APIs, structured data (JSON-LD), configuration files, and web applications. Malformed JSON causes silent failures — API calls fail, structured data doesn't get parsed by Google, configuration files crash applications. A JSON formatter and validator catches these errors before they cause problems in production.
JSON-LD structured data and SEO
Google's rich results (FAQ snippets, product prices, review stars, article dates) are primarily powered by JSON-LD — JavaScript Object Notation for Linked Data. Invalid JSON-LD is silently ignored by Google: no error in Search Console, no rich results. Validate your JSON-LD here before deploying to catch syntax errors that would prevent rich results.
Common JSON syntax errors
The most common JSON mistakes: trailing commas in arrays/objects (not allowed in JSON, only in JavaScript), single quotes instead of double quotes (JSON requires double), unquoted property names, using undefined instead of null, and comments (JSON has no comment syntax). This tool identifies exactly what's wrong and where.
JSON formatting for readability
Minified JSON (all on one line) is efficient for network transfer but unreadable for debugging. Formatted JSON with proper indentation makes the structure immediately clear. Use the 2-space or 4-space indent option based on your team's convention — both are valid JSON.
API response debugging
When debugging API responses, copy the raw JSON response from browser DevTools → Network → Response tab and paste here. The formatter makes nested objects and arrays immediately readable. The validator catches malformed responses that might cause client-side parse errors.
Minifying JSON for production
For production deployments, JSON should be minified to reduce payload size. JSON-LD in <script> tags, configuration objects embedded in HTML, and API response payloads all benefit from minification. This tool's minify output removes all non-significant whitespace.
JSON vs JSON5 vs JSONC
Standard JSON (RFC 8259) doesn't support comments or trailing commas. JSON5 and JSONC (JSON with Comments) are supersets that allow these features. This tool validates against strict JSON — if your file uses JSON5/JSONC syntax, it will show errors even though the file may be valid for its intended parser.
Pro Tips
Copy the JSON-LD from your <script type='application/ld+json'> tag and validate it here before pushing to production. Google won't show any error — it silently ignores invalid JSON-LD. A single misplaced comma can suppress rich results across your entire site.
When adding formatted JSON-LD to HTML, use 2-space indent to keep the code compact while readable. 4-space indent in embedded JSON-LD makes HTML files significantly larger. For the final production version, minify and paste the minified version.
The nesting depth indicator shows how deep your JSON structure goes. Google recommends keeping JSON-LD schemas relatively flat. Very deep nesting (depth > 8) in structured data often indicates unnecessary complexity — check if it can be simplified.
Frequently Asked Questions
- Why is my JSON-LD showing as invalid when Google Rich Results Test says it's OK?
- This can happen with JSON5/JSONC syntax (comments, trailing commas) — this tool validates strict JSON RFC 8259. Also check if your JSON-LD uses template variables ({TITLE}) — valid in templates but not in deployed JSON. If the deployed version passes Google's test but fails here, check for template/rendering issues.
- What's the maximum JSON size this tool handles?
- This tool runs entirely in the browser — there's no server upload. It can handle JSON up to several megabytes, limited by your browser's JavaScript memory. For extremely large JSON files (10MB+), a local CLI tool (jq) is more appropriate.
- Can this validate JSON Schema?
- This tool validates JSON syntax — it checks whether the text is valid JSON. It doesn't validate against a JSON Schema (the schema.org or custom schema that defines which properties are required). For schema validation, use Google's Rich Results Test for JSON-LD, or a dedicated JSON Schema validator.
- How do I extract JSON from a page for testing?
- To test a live page's JSON-LD: in Chrome, press F12 → Elements → search for 'application/ld+json' → copy the script tag contents. Or use DevTools → Console → run: document.querySelector('script[type="application/ld+json"]').textContent and paste the result here.