devtools4 min readUpdated on 2026-09-06

How to Format and Validate JSON Online — Instantly Fix Broken JSON

Minified or broken JSON is nearly impossible to read. Learn how to format it into clean, human-readable code and validate it against the JSON spec in one click.

Recommended Free Tool

Open JSON Formatter

Perform this task online in seconds with zero sign-up or watermarks.

Open JSON Formatter

Format JSON in One Step

Follow these simple step-by-step instructions:

1

Paste your JSON

Paste raw, minified, or broken JSON into the editor. The formatter accepts JSON objects {}, arrays [], strings, numbers, and booleans.

Pro Tip: You can also paste JSON from API responses, .json config files, or log outputs.
2

Click Format (or validate first)

Click 'Format JSON' to immediately prettify the output with proper indentation. Click 'Validate' to check for syntax errors without modifying the structure.

Pro Tip: Invalid JSON will highlight the exact line and character position where the error occurs.
3

Copy or download the result

Copy the formatted JSON to your clipboard or download it as a .json file. Use the 'Minify' button to do the reverse — compress formatted JSON back to a compact single line.

Pro Tip: Use the tree view to visually explore deeply nested JSON structures.

Common JSON Syntax Errors and How to Fix Them

JSON has strict syntax rules. Here are the most common errors developers encounter and how to fix them:

  • Trailing commas after last property: { "a": 1, } → Remove the trailing comma
  • Single quotes instead of double quotes: { 'key': 'value' } → Use double quotes
  • Unquoted property names: { key: "value" } → Always quote property names
  • Comments (// or /* */): Not allowed in JSON — remove all comments
  • Missing commas between properties: { "a": 1 "b": 2 } → Add comma after each property

JSON vs JSONC vs JSON5: What's the Difference?

Standard JSON (RFC 8259) is very strict: no comments, no trailing commas, no single quotes. This is what APIs and most programming language parsers expect.

JSONC (JSON with Comments) is used in VS Code config files (settings.json, tsconfig.json). It allows // comments but still requires double quotes.

JSON5 is a superset of JSON used in some configuration tools. It allows comments, trailing commas, and single quotes — but most APIs do not accept it.

If your JSON is valid but an API rejects it, check that you're sending the Content-Type: application/json header and that there are no BOM characters at the start of the string.

Ready to Get Started?

Try our tool right in your browser. Fast, secure, and 100% free.

Open JSON Formatter

Frequently Asked Questions

Related Guides & Tutorials

Related Tools

Explore other popular free tools in this category.

View all

Case Converter

Convert text between UPPERCASE, lowercase, camelCase, snake_case

Word Counter

Count words, characters, sentences, paragraphs and reading time

Lorem Ipsum Generator

Generate placeholder text and paragraphs

Regex Tester

Test and debug regular expressions with live highlights