Back to Blog

How to Open a JSON File

Mar 1, 20266 min read

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.

Example — user.json
{
  "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:

OSBuilt-in editorBetter free alternative
WindowsNotepadNotepad++, VS Code
macOSTextEdit (plain text mode)VS Code, BBEdit
Linuxgedit / nano / viVS 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

  1. Right-click the .json file.
  2. Select Open with → Notepad.
  3. The raw JSON text will appear. It may look compressed if the file is minified — use our formatter to make it readable.
  1. Right-click any .json file.
  2. Click Open with → Choose another app.
  3. Select Visual Studio Code and tick Always use this app.
  4. Double-clicking any .json file will now open it directly in VS Code with full syntax highlighting.

Method 4: Open on macOS

Using TextEdit

  1. Right-click the file in Finder.
  2. Select Open With → TextEdit.
  3. 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

  1. Right-click a .json file in Finder.
  2. Hold Option and click Always Open With…
  3. Navigate to Visual Studio Code in the Applications folder.
  4. All future .json files 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)

  1. Open Excel and go to Data → Get Data → From File → From JSON (Excel 2016+ with Power Query).
  2. Select your .json file.
  3. Use the Power Query Editor to expand the nested objects into columns.
  4. 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)

Node.js — read a JSON file
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

Python — read a JSON file
import json

with open('data.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

print(data['name'])  # Access any field directly

Bash / Terminal (Linux & macOS)

Terminal — pretty-print a JSON file
# 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.json

PowerShell (Windows)

PowerShell — read a JSON file
$data = Get-Content -Raw -Path .\data.json | ConvertFrom-Json
Write-Host $data.name

Method 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.json to 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 ijson library 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:

Minified (hard to read)
{"id":1,"name":"Alice","roles":["admin","editor"],"active":true}
Formatted (easy to read)
{
  "id": 1,
  "name": "Alice",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true
}

My JSON File Won't Open — Common Fixes

SymptomLikely causeFix
File opens but content is garbledWrong text encoding (not UTF-8)Re-open with UTF-8 encoding in your editor
"The file cannot be opened"File is corrupt or zero bytesCheck file size; re-download or restore from backup
JSON looks valid but errors on parseInvisible BOM character at startRe-save as UTF-8 without BOM
Excel shows one giant cellJSON is not tabular / not flatUse our JSON to CSV converter first
File with .json extension is binaryMisnamed 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.