JSON Formatter & Validator

Format, minify and validate JSON with syntax highlighting and error detection.

📐 How to Use

  1. Paste your JSON into the input box.
  2. Click "Format" to pretty-print with 2-space indentation, or "Minify" to collapse to one line.
  3. Any syntax errors are detected and shown with the line and character position.
  4. Click "Copy" to copy the output to your clipboard.

🎯 When to Use This

  • Checking an API response copied out of browser devtools, when the payload arrives as one long line and you need to find which field is missing.
  • Shrinking a formatted config file back to a single line before pasting it into an environment variable that cannot span several lines.
  • Confirming that a webhook body a third party rejected really is malformed, since the parser names the character position where it gave up.
  • Tidying hand-edited fixture data in a test suite so a reviewer sees the structure in the diff instead of a wall of text.

❓ Frequently Asked Questions

QWhat is JSON?
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, and easy for machines to parse and generate.
QIs my data sent to a server?
No — all processing happens entirely in your browser. Your JSON never leaves your device.
QWhat errors can this detect?
Any JSON syntax error: missing commas, unclosed brackets, invalid escape sequences, trailing commas, and incorrect value types.

ℹ️ About This Tool

JSON is a text format with a deliberately small grammar: objects, arrays, strings, numbers, true, false and null. The strictness is the point: it is what makes a file portable between languages. Keys must be double-quoted, comments are not part of the specification, a trailing comma after the last element is an error, and every number is read as a double-precision float. Most time spent debugging JSON goes on finding which of those rules a file broke.

This tool hands your text straight to the browser's own JSON.parse(). When parsing succeeds, formatting is JSON.stringify with two-space indentation and minifying is the same call without it, so the output matches what any JavaScript runtime would produce. When it fails, the engine's own error message is shown, including the character position where it stopped. Pasting into the box triggers a format attempt on its own, and the script makes no network request.

⚠️ Notes & Limits

  • JSON.parse reads every number as a 64-bit float, so an integer above 2^53 comes back rounded. Keep large IDs as strings if you need them intact.
  • Duplicate keys in an object are accepted as input but the last one wins, so formatting silently drops the earlier copies without warning you.
  • Comments, trailing commas and unquoted keys are rejected. JSON5, JSONC and newline-delimited JSON need a parser written for those dialects instead.
  • There is no schema checking here. Valid syntax says nothing about whether the required fields are present or hold the type a consumer expects.