Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

How to Open a JSON File (And Why Not to Paste It Into a Random Site)

Sean

Platform Writer

Sep 05, 2026
8 min read

A JSON file is a plain text file. Any text editor opens it — Notepad, TextEdit, VS Code, or the browser you already have open. There is nothing special to install, and the online viewers that dominate the search results are solving a problem you do not have while introducing one you did not want.

How to Open a JSON File (And Why Not to Paste It Into a Random Site)

The reason this gets searched so often is that double-clicking a .json file on most systems either opens nothing or offers a list of applications with no obvious right answer. The file itself is trivially readable. What actually varies is whether you want it readable, searchable, validated, or filtered — and those are four different tools.

Table of contents

Just reading it

The fastest option depends on what you have open.

  • Any text editor. Notepad on Windows, TextEdit on macOS, gedit or nano on Linux. The content appears as-is, usually on one very long line if it was minified.
  • A browser. Drag the file into a Chrome or Firefox window. Both render JSON in a collapsible tree with syntax colouring, and Firefox includes a filter box. This is the best zero-install option and almost nobody knows it.
  • VS Code or any code editor. Colouring, folding, validation, and Format Document to pretty-print a minified file. This is what you want if you will look at more than one of these.
  • The terminal. cat for small files, less for large ones, jq for anything you want to actually work with.

If the file arrives minified — one enormous line with no whitespace — pretty-printing is the first step. In VS Code that is Format Document. In a terminal:

# Pretty-print to the screen
jq . data.json

# Or without jq installed
python -m json.tool data.json

Both also validate as a side effect. If the file is malformed, they say where, which is considerably more useful than an application silently refusing to open it.

Why the file will not open by double-clicking

Because operating systems do not associate .json with anything by default. It is not a broken file; there is simply no registered handler.

On Windows, right-click, Open with, Choose another app, pick a text editor, and tick the box to always use it. On macOS, right-click, Get Info, change Open with, and click Change All.

Associating .json with your code editor rather than Notepad is worth the thirty seconds, because it gives you syntax colouring and folding for free every subsequent time.

One caution: do not associate it with a browser if you frequently edit these files, because you will keep opening a read-only view and wondering why you cannot type.

The JSON you actually encounter in a project

The generic advice above treats JSON as a mysterious file type. In practice, if you are opening one, it is almost certainly one of a small number of things, and knowing which changes what you should do with it.

  • package.json. Dependencies and scripts for a Node project. Edit carefully — a stray comma breaks every npm command with an unhelpful error.
  • tsconfig.json, eslintrc.json, and similar config. Note that some of these permit comments despite JSON not supporting them; that dialect is JSONC and a strict parser will reject the file.
  • composer.json, appsettings.json, and their equivalents in other ecosystems.
  • An API response you saved to inspect. Usually minified and usually the reason you wanted a viewer.
  • An export — analytics, a database dump, a backup. Frequently enormous, and covered below.
  • A .geojson, .har, or similar. Valid JSON with a different extension and a specialised viewer that will serve you better.

Two things break config files constantly and both are worth internalising. JSON does not allow trailing commas — a comma after the last item in an object or array is invalid. And JSON does not allow comments; if you need to annotate a config, most tools accept an unused key like a leading underscore field instead.

jq, which is the actual answer for anything non-trivial

For a file you want to search, filter, or extract from, an editor is the wrong tool and jq is the right one. It is a small command-line program that queries JSON the way a query language queries a database.

# Pretty-print
jq . data.json

# Top-level keys
jq 'keys' data.json

# One field from every element of an array
jq '.[].email' users.json

# Filter
jq '.[] | select(.status == "active")' users.json

# Reshape into something smaller
jq '[.[] | {id, name}]' users.json

# Count
jq 'length' users.json

# Convert an array of objects to CSV
jq -r '.[] | [.id, .name, .email] | @csv' users.json

The last one is worth knowing on its own. Turning a JSON export into a CSV you can open in a spreadsheet is a two-second job that people routinely do by hand.

jq is in every package manager — apt, brew, winget, choco — and is a single binary with no dependencies. It repays the twenty minutes it takes to learn the basics within about a week.

When the file is too big to open

A multi-gigabyte JSON file will hang a text editor, because most editors load the whole thing into memory and then try to syntax-highlight it.

First, look at it without loading it:

# Size
ls -lh big.json

# First 200 lines, to see the shape
head -c 2000 big.json

# Line count -- if it is 1, the file is minified or NDJSON
wc -l big.json

If it is one line, it is either minified JSON or, more likely for a large export, something else entirely.

That something else is usually NDJSON, also called JSON Lines: one complete JSON object per line, with no wrapping array. It is the standard format for large exports and log streams precisely because it can be processed a line at a time without loading the file. Most tools that choke on a huge JSON array handle NDJSON without effort:

# Process line by line, constant memory
jq -c 'select(.level == "error")' events.ndjson

# Just look at the first record
head -n 1 events.ndjson | jq .

For a genuinely huge single JSON document, jq —stream processes it incrementally rather than building the whole structure in memory. It is awkward to use and it works when nothing else will.

The online viewer problem

Search results for this question are full of online JSON viewers. They work, they are convenient, and they are a bad habit for one specific reason: pasting a file into one uploads its contents to somebody else’s server.

Consider what is typically in the JSON files you open. API responses containing customer records. Config files containing connection strings and API keys. Exports containing personal data. Tokens. Webhook payloads.

Pasting any of that into a third-party site is a data disclosure. It may be to a perfectly reputable operator; you have no way to verify that, no record of it, and if the data was personal or contractual, you may have just created a reportable incident.

This is not hypothetical caution. Credentials leak through convenience tools regularly — online formatters, diff tools, and encoders are a known route.

The alternatives cost nothing. Your browser renders JSON natively. Your editor formats it. jq does everything the online tools do and more, offline. If you must use a web tool, use one that runs entirely in the browser without uploading, and verify that claim by loading it and then disconnecting from the network before pasting anything.

How this fits the rest of the stack

JSON is text, so the tool depends on the task: a browser to look, an editor to change, jq to search or reshape, and NDJSON when the file is too big for any of them. The one habit worth dropping is pasting files into online viewers, because the files you open are usually the ones carrying config, credentials, or customer data. Environment variables and secrets belong in the platform rather than in a JSON file being passed around — on RunxBuild they are set per service and applied at deploy. If you are sizing what a project needs to run, the RunxBuild hosting calculator lays out the service, database, and storage separately.

Useful related references:

FAQ

What program opens a JSON file?

Any text editor, because JSON is plain text. For reading, dragging the file into Chrome or Firefox gives a collapsible tree view with no installation. For editing, a code editor such as VS Code adds colouring, folding, and validation. For searching or filtering, jq in the terminal is the right tool.

Why does my JSON file not open when I double-click it?

Operating systems do not associate .json with an application by default, so there is no registered handler. Right-click, choose Open with, pick your text editor, and set it as the default. Associating it with a code editor rather than a plain editor gives you syntax colouring every time after.

How do I open a very large JSON file?

Do not load it into an editor. Check the shape with head and wc -l first. If it is one object per line, it is NDJSON and jq processes it a line at a time in constant memory. For one enormous JSON document, jq —stream parses it incrementally rather than building the whole structure at once.

Is it safe to use an online JSON viewer?

It uploads the file contents to someone else’s server. Given that JSON files routinely contain API keys, connection strings, tokens, and customer records, that is a disclosure you cannot audit and may have to report. Your browser and your editor do the same job locally, and jq does considerably more.

Why is my JSON file invalid?

The two most common causes are a trailing comma after the last item in an object or array, which JSON does not permit, and comments, which JSON also does not permit even though some config formats accept them. Run jq . file.json or python -m json.tool file.json and both will report the line and position.

#json file#jq#json viewer#vs code#developer tools