fileview.dev

How to view a JSON file

8 min read

Written by the maintainer of fileviewer.dev, one of the tools compared below. The trade-offs against the alternatives are stated as plainly as I can manage.

To read a JSON file, open it in a browser (drag it into a tab), a code editor like VS Code, an online viewer, or the command line with jq — the right choice depends on the file’s size, how confidential it is, and whether you need to search it or just look at it.

Pick by what you have

The short version
Your situationUse
Just want to look at itDrag it into a browser tab
It is confidentialA client-side viewer, or an editor you already have
You need to search or transform itjq on the command line
It is 500 MB or morejq, or a streaming parser — not a browser
You want it as a table or a chartAn online viewer with those views
You are already in an editorStay there — format it in place

1. Drag it into a browser

Every modern browser renders a local .json file. Firefox has the best built-in viewer — a collapsible tree with filtering, no extension required. Chrome and Safari show raw text unless you install one.

  1. Open a new browser tab
  2. Drag the .json file onto it, or press Ctrl+O (Cmd+O on a Mac) and choose the file

Good for: a quick look, with nothing to install and nothing leaving your machine. Bad for: anything large, and any file whose one long line you actually need to read — Chrome and Safari will show it exactly as it is.

2. A code editor

VS Code, Sublime Text and their peers all handle JSON well: syntax highlighting, folding, and a format command that turns one long line into something readable. In VS Code that is Shift+Alt+F, or Shift+Option+F on a Mac.

Good for: files you are going to edit, and anything sensitive — it never leaves your machine. Bad for: a file you only want to glance at, if the editor is not already open. Very large files will also make most editors struggle.

3. The command line, with jq

jq is the right answer more often than people expect. It formats, filters and transforms, it streams rather than loading everything into memory, and it composes with everything else in a shell.

# Pretty-print
jq . data.json

# Just the names
jq '.users[].name' data.json

# Filter, then reshape
jq '.users[] | select(.age > 30) | {name, city: .address.city}' data.json

# Is it even valid?
jq empty data.json && echo "valid"

Good for: large files, anything repeatable, and any transformation. It is the only option here that scales to gigabytes. Bad for: getting an overview of a document whose shape you do not yet know — and it has a real learning curve.

4. An online viewer

Useful when you want a structural view without installing anything, and when a tree is not the reading you need — a table, a graph or a chart can answer a question faster.

The question to ask first is whether the tool uploads your file. Many do, because parsing on a server is simpler to build, and most do not say so clearly. You can check: open your browser’s network panel, load a file, and watch for a request carrying it. The stricter test is to disconnect from the network — a genuinely client-side tool keeps working.

Good for: a fast structural overview, and views a text editor does not have. Bad for: very large files, and — if the tool uploads — anything confidential.

Open a JSON file hereParsed in your browser. Nothing uploaded.

5. A browser extension

Extensions like JSON Formatter intercept every JSON response as you browse and render it as a tree automatically. If you spend your day reading API responses in a browser, this is the highest-leverage option on this page.

Good for: API work, continuously. Bad for: a one-off file, and worth remembering that an extension with permission to read page content is a meaningful amount of trust.

6. Python, if it is already installed

python -m json.tool data.json

# Or, keeping key order and handling non-ASCII properly:
python -c "import json,sys; print(json.dumps(json.load(open('data.json')), indent=2, ensure_ascii=False))"

Good for: formatting on a machine where installing jq is not worth it. Bad for: anything beyond formatting.

When the file will not open

It says the JSON is invalid
Something is genuinely malformed. Use a viewer that reports the position rather than only the fact — the usual culprits are a trailing comma, a missing closing brace, or single quotes where JSON requires double.
It opens blank, or the tab hangs
The file is probably too large for the tool. Check its size; above a few hundred megabytes, use jq or a streaming parser rather than anything in a browser.
Each line is a separate object
That is JSON Lines, not JSON — one complete value per line with no enclosing array. It is a different format, common for logs. jq reads it natively; a strict JSON parser will reject it.
It is one enormous line
Perfectly valid, just minified. Any formatter will fix it: jq ., your editor’s format command, or any viewer.
The text is mojibake
An encoding mismatch. JSON should be UTF-8; a file saved as UTF-16 or Latin-1 will look like garbage in a tool assuming otherwise.

Questions

How do I open a JSON file?

The quickest way is to drag it into a browser tab — Firefox shows a collapsible tree, Chrome and Safari show the raw text. For anything you want to edit, use a code editor like VS Code and run its format command. For large files or transformations, use jq on the command line.

How do I view a JSON file without installing anything?

Drag it into a browser tab, or use an online viewer. If the file is confidential, prefer one that parses in your browser rather than uploading — you can verify which by watching your browser’s network panel while the file loads.

What program opens a .json file?

Any text editor, since JSON is plain text. The better options add structure: VS Code and Sublime for editing, a browser or online viewer for reading, and jq for searching and transforming.

How do I view a very large JSON file?

Above a few hundred megabytes, use jq, which streams rather than loading the whole document into memory. Browser-based tools are limited by available memory, and most editors slow down considerably. Converting to JSON Lines first also makes a large dataset processable a record at a time.

Is it safe to use an online JSON viewer?

It depends on whether the tool uploads your file. A viewer that parses in your browser never transmits your data; one that posts it to a server has it, however briefly. Check the network panel, or disconnect from the network and see whether the tool still works — that is the test that cannot be faked.

How do I make a minified JSON file readable?

Format it. jq . file.json on the command line, Shift+Alt+F in VS Code, or any online viewer will re-indent it. The data is unchanged; only the whitespace differs.