JSON Formatter
Format, validate and compress JSON with error locations.
Frequently asked questions
- Is my JSON sent anywhere?
- No. Formatting and validation happen entirely in your browser — the text never leaves your device.
- What does "valid JSON" mean?
- The text parses successfully with JSON.parse and follows the JSON grammar: double-quoted keys, comma-separated values, and only objects, arrays, strings, numbers, booleans or null.
- Can I format a JSON file with hundreds of thousands of lines?
- Yes, but very large documents may be slow. The tool parses and stringifies in memory, so extremely large files are limited by your browser memory.
- Does it handle JSONP, URL-encoded input and big numbers?
- Yes. JSONP wrappers like callback({...}) are unwrapped automatically, URL/escape-encoded input can be decoded first, and number literals longer than 15 digits (beyond JavaScript’s safe integer range) are preserved exactly instead of being rounded.
- Can I edit the JSON directly in the tree view?
- Yes. In the tree view, click a leaf value to turn it into an inline editor. Press Enter or click away to apply the change, or Esc to cancel. The edited value is written back to the input as formatted JSON.
About this tool
JSON Formatter parses, validates and pretty-prints JSON, reports the exact line and column of syntax errors, and can minify, escape or unescape it. It also handles JSONP wrappers, URL-encoded payloads and very large number literals that JavaScript would otherwise round. All processing happens in your browser.
How to use it
- Paste JSON into the input editor — Format is the default mode.
- Choose indentation and whether keys should be sorted, then review the tree or code output.
- Switch to Minify for a compact payload, or Escape/Unescape to embed JSON in a string.
- Click any leaf value in the tree to edit it inline; the input is rewritten with the change.
← All tools