JSON formatter and validator
Paste JSON to pretty-print, minify or validate it. Errors are pointed out by line and column.
Valid JSON · 96 bytes → 146 bytes
About JSON
JSON in a nutshell
JSON (JavaScript Object Notation) is the most common format for exchanging data between programs and APIs. It has just six kinds of values: objects {}, arrays [], strings in double quotes, numbers, true/false and null.
Rules that trip people up
- Keys and strings must use double quotes:
{"a": "b"}, not{'a': 'b'}. - No trailing commas:
[1, 2, 3,]is invalid. - No comments, no
undefined,NaNorInfinity. - Numbers can't have leading zeros (
007) or a leading plus sign. - Control characters such as tabs and newlines inside strings must be escaped as
\tand\n.
Format or minify?
Formatting adds indentation and line breaks so humans can read and review JSON. Minifying removes all optional whitespace, which makes files smaller for storage and network transfer; servers that compress responses reduce the difference, though.
More tools
More on the bench
Base64 encoder and decoderEncode text to Base64 and back, including URL-safe Base64 and emoji. URL encoder and decoderPercent-encode and decode URLs and query values, and break a URL into parts. CSV to JSON converterConvert CSV to JSON and JSON to CSV, with delimiter detection. UUID generatorGenerate random v4 or time-ordered v7 UUIDs, one or a hundred at a time. JWT decoderRead the header and claims of a JSON Web Token, with expiry dates in plain English. Hash generatorSHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text.
Frequently asked questions
Is my JSON sent to a server?
No. DevBenchr parses and formats JSON in your browser with JavaScript, so API responses, configuration and anything else you paste never leave your device.
Why is my JSON invalid?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, comments, and special values like undefined or NaN. JSON is stricter than JavaScript; the error message points to the exact spot.
Does JSON allow comments?
No, standard JSON has no comments. Some tools accept "JSON with comments" (JSONC), such as VS Code settings files, but JSON.parse and most APIs reject them. Remove the comments or put notes in a regular field.
What does "sort keys" do?
It orders the keys of every object alphabetically, at every level. That makes two JSON documents much easier to compare. Arrays keep their order, because in arrays order matters.
How big a file can I format?
Several megabytes work fine in a modern browser. For very large files (tens of megabytes), a command-line tool such as jq is faster.