JSON formatter, beautifier and validator
Paste JSON to beautify, minify or validate it. If something is wrong, you see what and where, in plain words.
Valid JSON: an object with 4 keys, nested 2 levels deep.
96 bytes in, 146 bytes out
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.
It also works as a quick JSON viewer and linter: paste an API response to read it with proper indentation, or check a configuration file for mistakes before you commit it.
Valid JSON can still change on its way through a system: large IDs lose digits, and duplicate keys mean different things to different parsers. The JSON gotchas guide covers those cases.
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.
- Regex testerTest JavaScript regular expressions live, with groups, replace and common patterns.
- Text diff checkerCompare two texts or code snippets line by line or word by word.
- CSV to JSON and JSON to CSVConvert CSV to JSON and JSON to CSV, with delimiter detection.
- UUID (GUID) generatorGenerate random v4 or time-ordered v7 UUIDs, one or up to 1,000 at a time.
- JWT decoderRead the header and claims of a JSON Web Token, with expiry dates in plain English.
- MD5 and SHA hash generatorMD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text, with a match check.
- Unix timestamp (epoch) converterEpoch seconds or milliseconds to a readable date and back in any time zone, ISO 8601 too.
- Lorem Ipsum generatorPlaceholder paragraphs, sentences or words, plain or as HTML.
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 values from other languages such as undefined, NaN or Python’s True and None. JSON is stricter than JavaScript; the formatter names the cause and the line it is on.
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.