How to Open a JSON File
A JSON file (extension .json) is a plain-text file that stores structured data. Because it is ordinary text, you can open it with almost anything — a plain text editor, a browser, a spreadsheet app, or a few lines of code. This guide covers every practical method so you can pick the one that fits your situation.
What Is a JSON File?
JSON stands for JavaScript Object Notation. A .json file contains either an object ({ }), an array ([ ]), or a primitive value at the top level. It is UTF-8 encoded plain text — there is no binary magic, no proprietary format, and no special software required to read it.
{
"id": 1,
"name": "Alice",
"email": "[email protected]",
"roles": ["admin", "editor"],
"active": true
}JSON files are used everywhere: API responses, configuration files (package.json, tsconfig.json), database exports, app settings, and data pipelines.
Method 1: Open in a Text Editor (Quickest)
Because JSON is plain text, any text editor can open it. Right-click the file on your desktop or in Explorer/Finder and choose Open With:
| OS | Built-in editor | Better free alternative |
|---|---|---|
| Windows | Notepad | Notepad++, VS Code |
| macOS | TextEdit (plain text mode) | VS Code, BBEdit |
| Linux | gedit / nano / vi | VS Code, Sublime Text |
Use VS Code for JSON
Visual Studio Code opens JSON files with syntax highlighting, bracket matching, and built-in formatting (Shift+Alt+F on Windows, Shift+Option+F on Mac). It also shows schema-based IntelliSense for many well-known JSON file types like package.json and tsconfig.json. Download it free at code.visualstudio.com.
Method 2: Open in a Browser (No Install Required)
You can drag any .json file directly into a Chrome, Firefox, or Edge tab. The browser renders the raw text. Firefox applies automatic pretty-printing with collapsible nodes; Chrome and Edge display plain text.
For a formatted, interactive view in any browser, use our online formatter — no installation needed:
Open & Format Any JSON File Online
Paste your JSON (or drag & drop the file) to get an instantly formatted, colour-coded, interactive tree — right in your browser.
Method 3: Open on Windows
Using Notepad
- Right-click the
.jsonfile. - Select Open with → Notepad.
- The raw JSON text will appear. It may look compressed if the file is minified — use our formatter to make it readable.
Set VS Code as the Default App (recommended)
- Right-click any
.jsonfile. - Click Open with → Choose another app.
- Select Visual Studio Code and tick Always use this app.
- Double-clicking any
.jsonfile will now open it directly in VS Code with full syntax highlighting.
Method 4: Open on macOS
Using TextEdit
- Right-click the file in Finder.
- Select Open With → TextEdit.
- If TextEdit opens in rich-text mode, go to Format → Make Plain Text to see the raw content.
Set VS Code as the Default on Mac
- Right-click a
.jsonfile in Finder. - Hold Option and click Always Open With…
- Navigate to Visual Studio Code in the Applications folder.
- All future
.jsonfiles will open in VS Code automatically.
Method 5: Open in Excel or Google Sheets
Spreadsheet apps cannot open .json files directly, but you can convert JSON to CSV and import it.
Excel (Windows or Mac)
- Open Excel and go to Data → Get Data → From File → From JSON (Excel 2016+ with Power Query).
- Select your
.jsonfile. - Use the Power Query Editor to expand the nested objects into columns.
- Click Close & Load to import the data into a worksheet.
Google Sheets
Google Sheets has no native JSON importer, but you can use the ImportJSON Google Apps Script add-on, or convert the file to CSV first. Our free tool does the conversion in one click:
Convert JSON to CSV instantly
Use our JSON to CSV Converter to flatten your JSON into a spreadsheet-ready file. Download the CSV and import it directly into Excel or Google Sheets — no plugins needed.
Method 6: Open with Code
Reading a JSON file programmatically is the standard approach when building applications or scripts.
JavaScript (Node.js)
const fs = require('fs');
// Synchronous (simple scripts)
const data = JSON.parse(fs.readFileSync('./data.json', 'utf8'));
console.log(data);
// Or using require() for static files
const config = require('./config.json');
console.log(config.name);Python
import json
with open('data.json', 'r', encoding='utf-8') as f:
data = json.load(f)
print(data['name']) # Access any field directlyBash / Terminal (Linux & macOS)
# Print formatted JSON in the terminal
cat data.json | python3 -m json.tool
# Or with jq (install with: brew install jq / apt install jq)
jq '.' data.json
# Query a specific field
jq '.name' data.jsonPowerShell (Windows)
$data = Get-Content -Raw -Path .\data.json | ConvertFrom-Json
Write-Host $data.nameMethod 7: Open a Large JSON File
Text editors struggle with very large JSON files (100 MB+). Notepad or VS Code can freeze or crash trying to load an entire file into memory. Here are better options:
- jq (command-line): Streams the file without loading it all into RAM. Use
jq '.[] | .id' huge.jsonto extract specific fields from a large array. - VS Code with the "Large File Optimizations" setting: Go to Settings → Editor: Large File Optimizations. VS Code disables some features but stays stable up to a few hundred MB.
- Python with ijson: The
ijsonlibrary parses JSON incrementally (streaming), so memory usage stays flat regardless of file size. - DuckDB:
SELECT * FROM read_json_auto('huge.json') LIMIT 100— treat your JSON file like a SQL table and query only what you need.
My JSON File Looks Like Gibberish — How to Format It
Minified JSON is valid JSON — all whitespace has been removed to reduce file size. It looks like one long line and is hard to read. Paste it into our formatter to instantly expand it into a human-readable structure:
{"id":1,"name":"Alice","roles":["admin","editor"],"active":true}{
"id": 1,
"name": "Alice",
"roles": [
"admin",
"editor"
],
"active": true
}My JSON File Won't Open — Common Fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| File opens but content is garbled | Wrong text encoding (not UTF-8) | Re-open with UTF-8 encoding in your editor |
| "The file cannot be opened" | File is corrupt or zero bytes | Check file size; re-download or restore from backup |
| JSON looks valid but errors on parse | Invisible BOM character at start | Re-save as UTF-8 without BOM |
| Excel shows one giant cell | JSON is not tabular / not flat | Use our JSON to CSV converter first |
| File with .json extension is binary | Misnamed file (e.g. BSON, binary) | Check the originating application |
How to Edit and Save a JSON File
Once your JSON file is open in a text editor or VS Code, editing it is the same as editing any plain text file. A few tips to avoid breaking the structure:
- Never add trailing commas. JSON strictly forbids a comma after the last item in an object or array.
- Always use double quotes. All string values and all property names must be wrapped in double quotes.
- Validate before saving. Paste the content into our JSON Validator to catch syntax errors before committing the file.
- Use Format on Save in VS Code. Go to Settings → Format On Save and enable it. VS Code will auto-indent your JSON every time you press Ctrl+S.
Tree View for JSON Navigation
Our formatter includes a Tree View mode that lets you collapse and expand nested objects and arrays — perfect for navigating large JSON files without losing your place. Just paste your file and switch to Tree View.
Open, Format & Validate Your JSON File
Paste any JSON file content — minified or broken — and get it formatted, validated, and colour-coded instantly. No sign-up required.