JSON Viewer

Pretty-print, validate, and inspect JSON documents with optional key sorting and collapse/expand controls.

Pretty-print, validate, and inspect JSON documents with optional key sorting and collapse/expand controls. Pretty-print, validate, and inspect JSON documents with optional key sorting and collapse/expand controls.

Array

        
    

Background

What JSON is and why you might want to view it differently

JSON (JavaScript Object Notation) is the most common text format for exchanging structured data on the web: configuration files, API responses, log records, document stores, and many more. It is small, human-readable, and trivially machine-parseable, which is why almost every modern service speaks it.

A raw JSON document is rarely useful on its own. APIs and tools often emit a single long line with no whitespace, because that is the shortest representation. When you open such a document in an editor it is hard to scan, hard to spot mismatched brackets, and easy to lose your place while counting braces. A JSON viewer solves this by re-emitting the document with consistent indentation so the structure becomes obvious at a glance.

Features worth knowing

Pretty printing lets you choose an indent size (commonly two or four spaces) and immediately re-renders the document. Some viewers also let you sort keys alphabetically, which is invaluable when comparing two payloads from the same service: when keys line up vertically you can scan for value differences without matching by position. A stats line that reports the byte count and node count is helpful when you are about to paste a payload into a 1 MB-limited form: it tells you exactly how big it is without opening a terminal.

A viewer is also a validator. The act of parsing with JSON.parse will throw a descriptive error pointing to the exact line and column of the first invalid token, so you can immediately see why your document refuses to load. Most production tools produce errors at the same point, so the message you see here matches what your backend, frontend framework, or build pipeline would say.

Workflow tips

Use the collapse/expand controls to focus on the top level of a deeply nested document, drill down to the section you care about, and copy the branch you need. If you are debugging an API response, sort keys before comparing so that insertions and deletions at different positions do not confuse your eyes. When in doubt, paste the document into a new tab, tweak the formatting, and use the output as the canonical version for documentation or commit messages.

Built in-house with native JSON.parse and JSON.stringify only. Your input never leaves the browser.

Frequently asked questions

Does the viewer keep comments inside the JSON document?
Standard JSON does not allow comments. If your input contains // or /* */ comments the parser will reject it; remove them first or convert your file to JSON5/JSONC using a dedicated tool.
Why does the byte count not match what I copied from the API?
The byte count is the size of the rendered output. If you enable pretty-print with a 2-space indent, the output grows. Use the unindented mode if you need the on-wire size.
Can the viewer handle very large JSON documents?
Yes. The viewer parses the entire document in memory and re-emits it, so the practical limit is your browser's available heap (hundreds of MB comfortably on a modern laptop). For multi-GB documents consider a streaming approach.
Will sorting keys change the meaning of the document?
No. JSON objects are unordered collections of name/value pairs. Sorting changes only the emitted text, not the semantics. Most parsers read keys into a hash map regardless of order.
Why does the parser say "Unexpected token" at a specific column?
JSON.parse reports the first token it cannot make sense of. The line/column it gives is where the token starts; the actual mistake is often one character before (an unescaped quote, a missing comma, or a stray comma at the end of an object).
Is my document sent to a server?
No. All parsing, sorting, and reformatting happen inside your browser via native JavaScript APIs. There is no upload step.