How to open a JSON file

A JSON file is plain text, so any text editor opens it: Notepad on Windows, TextEdit on Mac, or simply your web browser. To actually read it, drop it into a JSON viewer like the one on this page, which formats it and shows it as a collapsible tree without uploading the file.

6 min read

The short answer

JSON (JavaScript Object Notation) files store data as text: keys and values in curly braces, lists in square brackets. Nothing about them is binary or proprietary, so you never need special software just to see what is inside. Right click the file, choose Open with and pick a text editor or a browser.

The catch is readability. Files exported by apps and APIs are usually written on one long line, which is fine for programs but useless for people. Drop the file onto the viewer below (or press Open file) and it is shown as a tree you can open and close, with item counts on every list and object. Switch Tool to Formatter to get indented text instead.

Try it here: JSON Viewer

Open the full tool page

Where JSON files come from

You usually meet a .json file in one of these situations: a data export from a website or app (Google Takeout, Facebook and Instagram downloads, banking and fitness apps), a response saved from an API, a settings file of a program or game, a product feed from an online store, or a backup made by a browser extension.

That matters because the goal differs. For a settings file you want to edit a value and save it without breaking the syntax. For an export you want to find one field among thousands of lines, or turn the data into a spreadsheet. The methods below cover all three: reading, editing and converting.

Ways to open a JSON file, compared

MethodBest forFormats the dataNotes
JSON viewer on this pageReading, searching, convertingYes, tree and indented textRuns in the browser, works on phones too
Notepad (Windows), TextEdit (Mac)Quick look, small editsNoOne line files are hard to read
FirefoxReadingYes, built in viewerRaw Data, Pretty Print and a filter box
Chrome, EdgeReadingPartlyShows text; recent versions add a pretty print option
VS Code or another code editorEditingYes, Format DocumentHighlights syntax errors while you type
Excel (Get Data, From JSON)Tables of recordsTurns it into rowsUses Power Query, mainly on Windows

Step by step on each device

  • Windows: right click the file, choose Open with, then Notepad. To make it the default, choose Choose another app and tick Always use this app to open .json files. For a formatted view, drag the file into a Firefox window or onto the viewer on this page.
  • Mac: right click (or Control click) the file, choose Open With, then TextEdit. Pressing the Space bar in Finder shows a quick preview of the text without opening any app.
  • iPhone and iPad: in the Files app, tap the file to preview it as text. To browse it as a tree, open this page in Safari, tap Open file and pick the file from Files.
  • Android: most file managers offer to open .json with a text viewer or a browser. Open this page in Chrome and use Open file for a formatted, collapsible view.
  • Command line: python -m json.tool file.json prints a formatted copy, and jq . file.json does the same with colors if jq is installed.

Reading a large JSON file comfortably

Big exports can run to tens of thousands of lines. In the viewer, everything below the top two levels starts collapsed, so you see the overall shape first: an object with five keys, an array with 2,481 items. Open only the branch you need. Expand all and Collapse all above the input open or close the whole document; very large documents are expanded up to a safe limit so the page stays responsive.

Hover over any node to see its path, for example $.orders[3].customer.name. That path is exactly what you need when writing code or a spreadsheet formula that reads the same field, and it saves counting brackets by hand.

Files of several megabytes open without trouble. Beyond that, the limit is your device's memory rather than the tool, and coloring is switched off for very large results to keep scrolling smooth.

Editing a JSON file without breaking it

JSON is strict, and a single wrong character makes the whole file unreadable for the program that uses it. If you edit a settings file, keep a copy first, then check the result before saving.

  • Keys and text values need double quotes. Single quotes are not allowed.
  • No comma after the last item in an object or array.
  • No comments. Lines starting with // or blocks between /* and */ are invalid in standard JSON.
  • true, false and null are written in lowercase without quotes.
  • Save as UTF-8 plain text. Word processors such as Word add formatting and must not be used.

When the file will not open or looks wrong

If the viewer says This is not valid JSON, the error box shows the line and column where the problem starts, together with the surrounding lines. The usual causes are the ones in the list above: a missing or extra comma, single quotes, or a comment. Switch Tool to Validator to check the file after you fix it; a valid file gets a summary such as 120 keys, 15 objects, 3 arrays, 4 levels deep.

Some files named .json are really JSON Lines (one complete JSON object per line, often .jsonl or .ndjson). Those are not a single valid document; open one line at a time, or wrap the lines in square brackets and separate them with commas.

Garbled letters such as é instead of é mean the file was opened with the wrong encoding. JSON is supposed to be UTF-8; open it in an editor that lets you choose UTF-8, or use the viewer, which reads the file as UTF-8.

Turning JSON into a spreadsheet

When the file is a list of records (orders, contacts, products), a table is easier to work with than a tree. Switch Tool to JSON to CSV: each item becomes a row, each key a column, and nested objects such as an address are flattened into columns like address.city. The preview shows the first 100 rows, and the downloaded CSV opens in Excel with accents intact.

Excel can also import JSON directly with Data, Get Data, From File, From JSON, which opens the Power Query editor. It is powerful but takes several clicks to expand nested records, and it is mainly available in the Windows versions.

Step by step

  1. Add the fileDrop the .json file onto the input box, press Open file, or paste the text. Try Sample to see how it works.
  2. Read the treeWith Tool set to Viewer, open and close branches; use Expand all or Collapse all for the whole document.
  3. Find a fieldHover over a node to see its path, such as $.orders[3].customer.name.
  4. Format, check or convertSwitch Tool to Formatter, Validator or JSON to CSV, then press Copy or Download.

Frequently asked questions

What program opens a JSON file?

Any text editor: Notepad on Windows, TextEdit on Mac, or a code editor such as VS Code. Browsers open it too, and a JSON viewer shows it as a readable tree.

Is my JSON file uploaded when I open it here?

No. The file is read and displayed in your browser. Its content is not sent to any server, so exports with personal data or API keys stay on your device.

Can I open a JSON file in Excel?

Yes, through Data, Get Data, From File, From JSON on Windows. A simpler route is converting it to CSV with the JSON to CSV option on this page and opening that file.

Why is my JSON file all on one line?

Programs save JSON without spaces to keep files small. Paste it into the Formatter or the Viewer to get line breaks and indentation back; the data does not change.

How do I open a JSON file on my phone?

On iPhone, the Files app previews it as text. For a formatted view on any phone, open this page in the browser, tap Open file and choose the file.

Does the viewer work offline?

Yes. After the page has been opened once, it keeps working without an internet connection.

Is it safe to open a JSON file?

Yes. JSON is data, not a program, so opening it in a text editor or viewer cannot run anything. The only risk is the program that later uses it, so only load settings files from sources you trust.