JSON Formatter & Validator

Paste any JSON — minified, poorly formatted, or just messy — and this tool will instantly validate and pretty-print it with syntax highlighting. JSON (JavaScript Object Notation) is the standard data interchange format used by virtually every REST API and configuration system. Invalid JSON is immediately flagged with a descriptive error message pointing to the problem location.

Paste JSON on the left →

Tip: Press Ctrl+Enter to format

Input
Output
Formatted JSON will appear here…

What this tool does

The JSON Formatter takes any JSON — minified API responses, hand-edited config files, database column dumps — and formats it with consistent indentation and syntax highlighting so you can actually read it. It also validates the input and flags syntax errors immediately, pointing to the location of the problem. If the JSON is valid, you get key count, max depth, and file size reported below the output.

How to use it

  • Paste your JSON into the left pane (or start typing).
  • The output updates automatically. Click Format or press Ctrl+Enter to force a re-parse.
  • Use the indent toggle (2, 4, or Tab) to match your project's style.
  • Click Sort Keys to sort all object keys alphabetically — useful before diffing two responses.
  • Click Minify to strip all whitespace for compact output.
  • Click Copy to copy the formatted output to clipboard.

Common mistakes that break JSON

  • Trailing commas{"key": "value",} is invalid in JSON (unlike JavaScript). Remove the comma after the last element.
  • Single quotes — JSON requires double quotes. {'key': 'value'} will fail.
  • Unquoted keys{key: "value"} is JS object syntax, not JSON.
  • Comments — JSON has no comment syntax. Any // or /* */ will break the parser.
  • Truncated input — "Unexpected end of JSON" usually means a missing closing brace or bracket, or the text was cut off mid-paste.

Frequently Asked Questions

What is the difference between minify and format?

Formatting adds indentation and line breaks to make JSON readable to humans — good for editing, reviewing, and debugging. Minifying strips all whitespace to reduce payload size — useful for API responses and stored data. Both versions are semantically identical; JSON parsers treat them the same.

Why would I want to sort keys?

When comparing two API responses for the same resource, key order differences make visual diffing harder. Sorting keys alphabetically first produces consistent output that's easy to compare. It also helps when reviewing large objects — you can scan for a key by name instead of scanning by position.

Does this tool send my JSON anywhere?

No. Everything runs in your browser using JavaScript's built-in JSON.parse(). Nothing is transmitted. This matters if you're pasting API responses that contain authentication tokens, user data, or other sensitive content.

Want the full explanation? Read the guide: Making Sense of JSON: Formatting, Validation, and Common Errors →