Skip to content

How to open a JSON file

Every way to open and read a .json file, from the quickest to the most powerful, and how to fix one that will not open.

By Shahzad Ali ·

What a JSON file is

JSON (JavaScript Object Notation) is plain text that stores data as objects of "key": value pairs and as lists in square brackets. APIs, configuration files and data exports use it. Any program that opens text can open a .json file; the hard part is reading it when it is one long line or nested many levels deep.

The quickest way: open it in your browser

Drop the file on the JSON viewer, or paste JSON with Ctrl+V (Cmd+V on a Mac). It shows a tree you can fold, a table when the file is a list of objects, and the text with line numbers. Nothing is uploaded, and it works on a phone too: tap Choose a file and pick the .json from Files or your downloads. Files up to 10 MB open.

On Windows or a Mac with no extra software

Every browser opens JSON: drag the file onto a Chrome, Edge or Firefox window. Firefox shows a built-in viewer with a collapsible tree; the others show the text. Notepad on Windows and TextEdit on a Mac open it as text too: right-click the file, choose Open with, and pick the editor. They are fine for small files, but long lines and deep nesting are hard to follow.

In a code editor

If you work with JSON often, a code editor such as the free Visual Studio Code colours the syntax, folds objects and marks errors. Format Document (Shift+Alt+F on Windows, Shift+Option+F on a Mac) indents a file saved on one line.

Make a one-line file readable

A file saved on a single line is valid but unreadable. The JSON formatter indents it with 2 or 4 spaces (anything from 1 to 8, or a tab), can sort the keys, and minifies it again when you need a small file.

If the file will not open

The message usually says why:

  • "Unexpected token" or "Unexpected end of JSON input" means the text breaks a JSON rule: a trailing comma, single quotes or a comment. The JSON validator shows the line and column and repairs the common mistakes, and the guide to unexpected token errors explains each message.
  • A file that starts with < is an HTML page saved with a .json name, often an error page from a server.
  • A file with one JSON object per line (.jsonl or .ndjson) is JSON Lines: each line is a separate document, so an ordinary JSON parser rejects the file as a whole, and OpenAnyDoc does not open it yet.
  • Above 10 MB OpenAnyDoc refuses the file to keep the page responsive; a code editor or a command-line tool such as jq handles larger ones.

Turn JSON into a spreadsheet

If the file is a list of records, the JSON to CSV converter flattens it into columns (nested fields become headers such as address.city) and opens the result as a table you can download and open in Excel.

Questions?

Write to support@openanydoc.com and say what you see when you open the file (no personal data).