How to open a JSON file on Windows, Mac, a phone or in Excel
· 4 min read · By GigaJSON
A .json file is plain text: names and values in a format called JavaScript Object Notation, used by apps, APIs and exports of all kinds. You don't need special software to open one. The program you pick only changes how readable it is.
Here is what works on each system, from what's already installed to tools that show the data as a tree.
The quickest way on any device
Open the JSON viewer in your browser, click Open file and pick the file. It shows the data as a tree you can expand, a table for lists of records, and the formatted text. The file is read on your device and never uploaded, and it works the same on Windows, Mac, Linux and phones.
On Windows
Right-click the file, choose Open with, then Notepad. If Windows asks how to open .json files, pick Notepad and tick Always use this app if you want that every time.
Notepad shows the text exactly as it is. That's enough for a small settings file. If the whole file is one long line, see the file is one long line below.
On a Mac
Select the file in Finder and press the space bar. Quick Look shows the text without opening any app.
To open it, Control-click the file, choose Open With, then TextEdit. TextEdit opens plain text as plain text, so nothing gets reformatted.
In a web browser
Drag the file into a browser window, or press Ctrl+O (⌘O on a Mac) and choose it.
- Firefox has a JSON viewer built in. It shows a collapsible tree, a filter box and a Raw Data tab with a Pretty Print button.
- Microsoft Edge also has a built-in viewer, with indentation, colours and folding.
- Chrome shows the raw text. The GigaJSON extension for Chrome and Firefox turns
.jsonfiles and API responses into a tree in the same tab.
In VS Code
VS Code opens JSON with colours and folding, and flags syntax errors as you type. To add indentation to a one-line file, run Format Document: Shift+Alt+F on Windows, Shift+Option+F on a Mac, Ctrl+Shift+I on Linux.
VS Code turns off some features for very large files, so for files of hundreds of megabytes see the large-file guide.
On a phone
Phones don't come with a JSON viewer, and tapping a .json file often shows nothing useful. Open the JSON viewer in the phone's browser, tap Open file, and choose the file from Files (iPhone) or Downloads (Android). The tree and table work on a small screen, and nothing leaves the phone.
In Excel
Excel opens JSON when the data is a list of records, like this:
[
{ "id": 1, "name": "Ada Lovelace", "city": "London" },
{ "id": 2, "name": "Grace Hopper", "city": "New York" }
]
There are two ways:
- Power Query. In Excel for Windows, choose Data > Get Data > From File > From JSON, pick the file, then use To Table and the expand buttons in the Power Query editor to turn records into rows and columns. It takes a few clicks, but you can refresh the query when the file changes.
- Convert to .xlsx first. JSON to Excel writes a spreadsheet in your browser. Each key becomes a column, nested objects become columns like
address.city, numbers stay numbers, and IDs like007keep their zeros. For a CSV instead, use JSON to CSV.
From the command line
If Python is installed, this prints the file with indentation:
python3 -m json.tool data.json
With jq, the same with colours:
jq . data.json
In a Python script, json.load reads the file into dictionaries and lists:
import json
with open("data.json", encoding="utf-8") as f:
data = json.load(f)
print(data[0]["name"])
The file is one long line
Programs often save JSON without line breaks to keep files small. The data is the same; it's just hard to read. Paste it into the JSON formatter (or open the file there) to get one value per line with consistent indentation, or use Format Document in VS Code.
The file won't open or shows an error
An error usually means the JSON itself is broken: a missing comma or quote, a trailing comma, a comment, or a file that was cut off during download. The JSON validator shows the line and column of the first problem. How to fix invalid JSON covers the ten most common errors, and JSON Repair fixes most of them for you and lists each change.
If the file opens but shows strange characters, check the extension. A file that starts with PK is a zip archive renamed to .json, and one that starts with < is HTML or XML.
The file is very large
Notepad and TextEdit slow down badly on files of tens of megabytes, and most editors stop responding somewhere past a few hundred. The Large JSON Viewer opens files up to 1 GB in a browser tab: parsing runs in a background worker, and only the rows on screen are drawn. For other options, including jq and streaming in Python, read how to open a large JSON file.
To edit the file rather than just read it, open it in the GigaJSON app, which saves your documents in the browser with undo and version history.