How to open a JSON file on Windows, Mac or in a browser
How to open a JSON file with apps you already have: Notepad, TextEdit, a browser or Excel, plus how to make a one-line file readable without uploading it.
To open a JSON file, right-click it (Control-click on a Mac) and open it with a text editor: Notepad on Windows or TextEdit on a Mac. JSON is plain text, so nothing special is needed to see what’s inside. The trouble is that many JSON files arrive squashed onto a single line, which is hard to read. Paste the text into Lokafile’s JSON Formatter and it comes back neatly indented, with errors pointed out by line and column, and nothing leaves your browser.
What a JSON file is
JSON stands for JavaScript Object Notation. The standard that defines it, RFC 8259, calls it "a lightweight, text-based, language-independent data interchange format". The same document registers .json as the file extension and application/json as the media type, and says JSON exchanged between systems outside a closed ecosystem must be encoded as UTF-8.
In practice it looks like this:
{
"name": "Ada",
"orders": [1042, 1043],
"newsletter": true
}
Curly brackets hold named values, square brackets hold lists, and text goes in double quotes. Apps use it for settings files and for the data websites pass back and forth. If you double-click a .json file and Windows asks which app to use, no app has been set for that extension yet. If it opens in the wrong app, use Open with to pick another.
Which app to use
| You want to | Use | Already on your computer? |
|---|---|---|
| Glance at a small file | Notepad or TextEdit | Yes |
| Read a minified, one-line file | JSON Formatter (any browser) or Firefox | Yes, in your browser (Firefox is a free download) |
| Look at the data as rows and columns | Excel (Get Data > From JSON) | If you have Excel |
| Edit it and keep it valid | A code editor such as VS Code | Free download |
How to open a JSON file on Windows
Microsoft’s page on file name extensions in Windows gives the route for any file type Windows doesn’t recognise:
- Right-click the .json file.
- Select Open with, then Choose another app.
- Pick Notepad from the list. If it isn’t shown, select Choose an app on your PC and find it.
Notepad shows the text exactly as it is stored. That’s fine for a settings file a few lines long. For a big export on one line, the next section is quicker.
How to open a JSON file on a Mac
Apple’s guide to choosing an app to open a file lists several ways. One is to Control-click the file in the Finder, choose Open With and pick TextEdit. You can also select the file and use File > Open With, or drag it onto an app’s icon in the Dock.
The same guide explains how to make a choice stick for every file of that type, through the file’s Info window and its Open with section, so .json files always go to the app you prefer.
Make a one-line JSON file readable
Minified JSON has every space and line break removed to keep it small. The data is all there, but a 2,000-character line is no fun to read. There are two easy ways to lay it out.
Paste it into a formatter.
- Open the file in Notepad or TextEdit, select all and copy.
- Go to Lokafile’s JSON Formatter and paste into the input box.
- Choose 2 spaces, 4 spaces or Tab and press Format. Copy the result, or press Download .json to save a tidy copy.
If the JSON is broken, the formatter tells you the line and column where it stopped, which usually points at a missing comma or a bracket that was never closed. The formatting happens in your browser and the text isn’t sent anywhere. That matters, because JSON exports often hold customer details or access tokens.
Open it in Firefox. Firefox has a built-in JSON viewer. Mozilla’s JSON viewer documentation says that when you open a JSON file in the browser it is parsed and given syntax highlighting, with arrays and objects collapsed until you expand them. There’s a search box to filter the data, and you can switch to the raw JSON and pretty-print it. Drag the file into a Firefox window to try it.
How to open a JSON file in Excel
When the JSON is a list of records, such as orders or contacts, a spreadsheet is often the easiest way to read it. Microsoft’s guide to importing data with Power Query covers Excel for Microsoft 365 (Windows and Mac), Excel 2024, 2021, 2019 and 2016:
- Select Data > Get Data > From File > From JSON.
- In the Import Data dialog, find the JSON file and select Open.
- The Power Query editor opens. Tidy the columns if you need to, then load the table into your sheet.
Microsoft’s Power Query JSON connector notes say the editor uses automatic table detection to flatten the JSON into a table. If you get an "unable to connect" message, the same page lists the usual causes: the file isn’t really JSON, it’s malformed, or it’s a JSON Lines file with one record per line. Checking it in the formatter first rules out the malformed case.
Editing a JSON file without breaking it
Reading is safe in any app, but editing in Notepad is risky, because nothing warns you when you delete a comma. A code editor is safer. Microsoft’s Visual Studio Code documentation lists what it adds for JSON: suggestions as you type, red squiggles when the file breaks its schema, Format Document on the right-click menu, and folding for every object and list.
These mistakes stop a file loading:
- a comma after the last item in a list or object
- single quotes where JSON needs double quotes
- keys without quotes, such as
{name: "Ada"} - comments, which standard JSON doesn’t allow
Some settings files bend that last rule. VS Code’s documentation says its own settings files use a separate "JSON with Comments" mode that accepts // and /* */ comments, and that mode isn’t standard JSON. Other programs may reject a file written that way.
After any edit, paste the file into the JSON Formatter to confirm it’s still valid before you send it on. If the JSON holds an ID you need to generate, the UUID generator makes one, and Base64 decode helps when a value inside is Base64-encoded.
Questions people ask
What program opens a JSON file?
Any plain text editor can open one, because JSON is text. On Windows that means Notepad; on a Mac, TextEdit. Firefox shows JSON files with colours and folding, Excel can turn them into a table, and a code editor such as Visual Studio Code adds formatting and error checks.
Can I open a JSON file in Excel?
Yes. In Excel for Microsoft 365, 2016 or later, choose Data > Get Data > From File > From JSON, pick the file and select Open. Power Query opens and tries to flatten the data into a table, which you can then load into the sheet.
How do I open a JSON file on Android or iPhone?
A JSON file is plain text, so any text-editor or file-viewer app that shows text will display it. If it arrives as one long line, copy the text, open Lokafile’s JSON Formatter in your phone’s browser and paste it in. The formatter lays it out with indents, and the text stays on your phone.
Why does my JSON file open as one long line?
It has almost certainly been minified: all the spaces and line breaks between values have been stripped to make it smaller. The data is the same. Paste it into a JSON formatter, or use Format Document in a code editor, to spread it back over separate lines.
How do I create a JSON file?
Type or paste the JSON into a plain text editor and save it with a .json extension. The JSON standard, RFC 8259, requires UTF-8 for JSON exchanged between open systems, so pick UTF-8 if your editor asks. Run it through a validator before you use it, because one stray comma stops the whole file loading.