A JSON file is plain text, so you can open it with any program that reads text. The question is which one makes it readable. A minified file is one long line, and a large one can have thousands of nested fields.
This guide covers the quickest way to open a .json file on Windows, macOS and Linux, how to view it as a tree, and what to do when it will not open.
What is a .json file?
A .json file holds data in JSON (JavaScript Object Notation), a text format of objects, arrays, strings, numbers, booleans and null. Apps use it for settings, exports, API responses and saved data. It is not a document or a program, so double-clicking it may open the wrong app or ask which one to use. See What is JSON? for the basics.
Open a JSON file in your browser
Drag the file into a browser window, or press Ctrl+O (Cmd+O on macOS) and pick it.
- Firefox has a built-in JSON viewer with a collapsible tree, a raw view and a filter box.
- Edge formats JSON with its built-in viewer, with syntax colors and collapsible sections.
- Chrome shows the raw text, with a Pretty-print checkbox in recent versions. An extension can add a tree view.
- Safari shows the raw text.
Open it online with a JSON viewer
A browser-based JSON viewer gives you a tree, formatting and error checking without installing anything. In the JsonKit viewer, click Upload or drag the file onto the input pane. The file is read by your browser and is not uploaded to a server.
{⌄}JSON ViewerOpen a .json file as a collapsible tree with key and item counts.→If the file is minified, the JSON formatter pretty-prints it with 2-space or 4-space indentation so you can read it as text.
Open it in a text editor
- Windows: right-click the file, choose Open with, then Notepad. Notepad shows the text but does not format it.
- macOS: right-click, choose Open With, then TextEdit. It shows the text without formatting it.
- Any system: VS Code, Sublime Text and other code editors add syntax colors, folding and error marks. In VS Code, run Format Document (Shift+Alt+F on Windows, Shift+Option+F on macOS) to pretty-print the file.
To make an app the default for .json files, choose it in the Open with dialog and set it as the default on Windows, or use Get Info, Open with and Change All on macOS.
Open it from the command line
On macOS and Linux, cat prints the file. To pretty-print it, use Python, which most systems already have, or jq.
# Pretty-print with Python (no install needed on most systems)
python3 -m json.tool data.json
# Pretty-print and colorize with jq
jq . data.json
# Page through a large file
jq -C . data.json | less -ROn Windows, PowerShell can read it with Get-Content data.json -Raw | ConvertFrom-Json. See the jq cheat sheet for filtering large files.
Open a JSON file in Excel
Excel for Microsoft 365 on Windows can import JSON with Power Query: Data, then Get Data, then From File, then From JSON. It works best when the file is an array of objects, where each object becomes a row.
A simpler route is to convert the file first. The JSON to Excel converter turns an array of objects into an .xlsx workbook you can open anywhere, including Numbers and Google Sheets.
→xlsxJSON to ExcelConvert a JSON array into an Excel workbook.→When a JSON file will not open
- The viewer shows an error: the file is not valid JSON. Paste it into the JSON validator to find the line and column. How to fix JSON syntax errors explains each message.
- Strange characters at the start: the file may have a byte order mark or a different encoding. Save it as UTF-8 without a BOM.
- The editor freezes: the file is very large. Use the command line, which streams the file, or a viewer that collapses nested data.
- It contains comments: files like tsconfig.json use JSONC, which strict viewers reject. See JSON comments.