How to open a JSON file
A .json file is plain text. Anything that opens a text file will open it — the question is what makes it readable.
Last reviewed
Do it now
In a browser, with no installation
Drop the file onto a JSON viewer page. Nothing uploads: the browser reads the file locally, and you get a collapsible tree with search rather than a wall of text. This is the fastest route on any operating system, and the only one that works the same on a phone.
Windows
- Notepad opens it, but shows a minified file as one enormous line.
- VS Code opens it with highlighting and folding, and Shift+Alt+F formats it.
- Notepad++ works well with the JSON Viewer plugin.
- Do not double-click: Windows may have associated .json with a browser or an IDE you did not intend.
macOS and Linux
- TextEdit, nano, vim — all fine for small files.
- On the command line, jq . file.json formats and colourises, and jq keys gives you the top-level shape immediately.
- python3 -m json.tool file.json is available almost everywhere and needs nothing installed.
Android and iOS
Mobile text editors mostly do not fold or highlight, which makes a real document unreadable. Opening the file in a browser-based viewer is genuinely the better option here — share the file into the browser, or open it from Files.
When the file is too big to open
Past a few hundred megabytes, editors stop being useful and start being a memory problem. Take a look at the beginning first — head -c 2000 file.json — to learn the shape, then use a streaming tool such as jq rather than anything that loads the whole document.
If the file is newline-delimited JSON (one document per line, common in log exports), you can process it a line at a time, which changes the problem entirely.
When it will not open at all
Check that it is actually JSON. A .json extension on an HTML error page, a gzipped body, or a JSONP response wrapped in callback(...) all fail the same way. Look at the first character: a valid document starts with {, [, ", a digit, t, f or n — anything else, and you are holding something other than what you think.
Keep reading
- How to handle large JSON files — The limit is rarely the file size. It is what loading it into memory as objects, and rendering it as DOM nodes, actually costs.
- What is JSON? — JSON is a text format for structured data. It has six value types, one page of grammar, and a handful of rules that trip people up constantly.