Home › Blog

How to open a JSON file

A .json file is plain text written in JSON syntax, so you do not need special software to open it. Which program to use depends on whether you want to read it, edit it, or work with it as a table.

What is inside a .json file

JSON stores data as objects in curly braces and lists in square brackets, with keys in double quotes. Here is a small file with two records:

[
  { "name": "Ada Lovelace", "country": "GB", "active": true },
  { "name": "Grace Hopper", "country": "US", "active": true }
]

JSON that systems exchange is UTF-8 text by definition (RFC 8259), so any text editor shows Turkish, German or Chinese characters correctly as long as it reads the file as UTF-8.

Open it in a text editor

On Windows, right-click the file, choose Open with and pick Notepad. On a Mac, TextEdit opens it too. This is fine for a quick look or a small edit. A long file written on a single line is hard to read this way.

A code editor is more comfortable. Visual Studio Code colours the syntax, folds objects so you can collapse what you do not need, and reformats a one-line file with Format Document (Shift+Alt+F on Windows). It also underlines syntax errors, which helps when a program refuses to read the file.

Open it in a browser

Drag the file into a browser window. Firefox has a built-in JSON viewer with collapsible nodes, a filter box and a Raw Data tab. Chrome shows the text as it is, with a Pretty-print checkbox at the top that indents it. Nothing is uploaded when you open a local file this way.

Open it as a table in Excel

When the JSON is a list of records, a spreadsheet is often the easiest way to scan, sort and filter it. You have two options:

When the file will not open

If a program says the file is invalid, the JSON itself is usually broken. The common mistakes are a comma after the last item, single quotes instead of double quotes, and comments: JSON has no comment syntax. Paste the text into the converter on this site and it shows the parser's error message, which names the problem and usually the position.

Want something to practise on? The sample JSON files cover a flat list, nested records, a single object and an API-style response.