Skip to content

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.

Mode
Indent

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, NaN or Infinity.
  • 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 \t and \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.

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.