Online JSON Formatter & Validator

Format, validate, and auto-fix JSON instantly. Repairs trailing commas, comments, and missing quotes. Handles large files (100MB+) in your browser.

JSON Formatter

📁 Drag and drop a .json file or paste JSON

How to Use JSON Formatter

  1. 1 Paste or type your JSON in the editor
  2. 2 Auto-validation runs as you type (red squiggly = error)
  3. 3 Invalid JSON? We try to auto-fix trailing commas and comments
  4. 4 Click "Prettify" for 2-space formatting or "Minify" for compact
  5. 5 Use "Mask Secrets" before taking screenshots (hides API keys)
  6. 6 Copy or download the formatted result

What You Get

Professional JSON formatter with VS Code-quality editor. Handles malformed JSON that other tools reject. Supports files up to 100MB without freezing.

Input: {"name":"John",}

Output: { "name": "John" } // Trailing comma fixed!

Input: // Comment {"key": "value"}

Output: { "key": "value" } // Comment removed

How do I format JSON online?

Paste your JSON, click Prettify for readable format with indentation, or Minify for compact single-line format. Formatting is instant and happens in your browser.

How do I fix invalid JSON?

Paste your JSON - the tool auto-detects and fixes common errors like trailing commas, comments, unquoted keys, and single quotes. Fixed output is valid JSON.

Why does my JSON work here but fail elsewhere?

This tool uses JSON5 fallback which tolerates trailing commas, comments, and unquoted keys. Other tools may be stricter. We auto-fix these issues.

How do I validate JSON syntax?

Paste your JSON. Red underlines indicate errors. Hover over errors to see what is wrong: missing commas, unquoted strings, incorrect brackets, etc.

Can I format large JSON files?

Yes. Files up to 100MB are handled efficiently. For very large files, progress indicators show status. All processing happens locally in your browser.

How do I hide API keys in JSON before sharing?

Click Mask Secrets. This replaces values of keys like password, token, apiKey, and secret with ******** so you can safely share screenshots.

What indentation does the formatter use?

Default is 2 spaces which is standard for most projects. The output is valid JSON regardless of indentation. Minify removes all whitespace.

How do I copy formatted JSON?

Click the Copy button to copy the entire formatted output to your clipboard. You can also download as a .json file.

100% client-side processing - your JSON never leaves your browser.