JSON Viewer & Formatter

Paste, upload, or drop a JSON file to validate and pretty-print it with syntax highlighting.

Or drag and drop a .json file onto the box above.

Formatted JSON

Your formatted JSON will appear here.

How do I format and validate JSON?

Paste your JSON into the box above, or drop a file onto it, and it is checked and pretty-printed instantly — there is no button to press and nothing is ever uploaded to a server. I built this JSON viewer because I kept pasting API responses into random online formatters and then wondering whether they were quietly logging my data.

When the text is valid, you get it re-indented with two spaces and colour-highlighted, so keys, strings, numbers, and booleans are easy to tell apart at a glance. When it is not, you get a clear error instead of a blank screen.

What does the error message tell me?

It shows the exact reason the parser rejected your text, straight from the browser’s own JSON.parse. Most failures come from a small handful of mistakes: a trailing comma after the last item, single quotes used instead of double quotes, keys left unquoted, or a stray comment — JSON allows none of these.

The message usually points at the position where parsing broke, so you can jump to the part that needs fixing instead of reading the whole document line by line.

What officially counts as valid JSON?

JSON is not a loose convention — it is a formally specified format, and two standards define it: the IETF’s RFC 8259 (an Internet Standard, STD 90, published December 2017) and Ecma International’s ECMA-404 (2nd edition, December 2017). Both describe the same syntax. RFC 8259 sums up the entire type system in a single sentence:

JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays).

— RFC 8259, Section 1

So every value the viewer checks is one of exactly six types:

Type Category Example
string primitive "hello"
number primitive 42, -3.14, 1e5
boolean primitive true / false
null primitive null
object structured {"key": "value"}
array structured [1, 2, 3]

These same specifications are also why the parser is strict. JSON allows no trailing comma after the last item, no comments of any kind, and keys must be wrapped in double quotes rather than single quotes — the three mistakes behind most “invalid JSON” errors. RFC 8259 additionally requires that JSON exchanged between independent systems “MUST be encoded using UTF-8”, which is why this tool reads every file as UTF-8. If you want the exact grammar, MDN’s JSON.parse reference lists each rule with examples.

Can I upload or drag in a JSON file?

Yes. Use the upload link to pick a .json or .txt file, or drag one straight onto the input box and drop it. The file is read locally with the browser’s FileReader, formatted in place, and never leaves your machine.

This is handy for larger payloads that are awkward to copy and paste, like an exported configuration or a saved API response. Once it is formatted, the copy button puts the clean version on your clipboard in one click.

When is a JSON viewer actually useful?

The cases I reach for it most are everyday developer chores. A few common ones:

  • Pretty-printing a minified API response so you can actually read it.
  • Validating a config file before you commit it.
  • Spotting the misplaced bracket or comma that broke your build.
  • Cleaning up JSON copied out of browser devtools or a log line.

Because everything runs in your browser, you can paste tokens, internal payloads, and private data without worrying about them ever leaving your machine.

Related tools