JSON Formatter
Format, validate and beautify JSON data
About JSON Formatter
JSON Formatter parses your input against RFC 8259 and re-serializes it with consistent indentation so every nested key and value becomes readable at a glance. It surfaces syntax errors — trailing commas, single-quoted strings, unquoted keys — that are accepted by many runtime parsers but violate the spec. Useful for inspecting raw API responses, preparing data for diffs, and catching malformed payloads before they reach production.
Common Use Cases
Frequently Asked Questions
Why does my JSON fail here but work in my app?
Many parsers are lenient by design and accept trailing commas, single-quoted strings, or JavaScript comments. RFC 8259 forbids all of these. The formatter validates against the strict standard, which is what any cross-language or cross-platform exchange should follow.
What is JSONC and why doesn't standard JSON allow comments?
JSONC (JSON with Comments) is an unofficial extension used by editors like VS Code for configuration files. Standard JSON intentionally omits comments — Douglas Crockford's rationale was that allowing them would encourage people to embed parsing directives, turning JSON into a configuration format rather than a pure data interchange format. Strip comments before using JSONC files as API payloads.
Is there a size limit?
This tool runs in your browser using JSON.parse. For most inputs up to a few megabytes this is instant. Files above roughly 50–100 MB risk hitting the V8 string limit or causing the tab to stall — for very large files, use a native tool like jq on the command line instead.
How does this differ from JSON.stringify(obj, null, 2) in JavaScript?
JSON.stringify only works on a value already in memory. This tool accepts raw text, validates it before parsing, and reports errors instead of throwing an uncaught exception. Key order is preserved (insertion order), and it handles edge cases like top-level arrays or primitives that stringify handles but some tools do not.