Docento.app
Notebook, coffee, and laptop on a desk
All Posts

How to Open a JSON File on Windows, Mac, Android and iPhone

By The Docento.app TeamPublished 4 min read
Try Docento's free PDF editor — No sign-up, 100% private — sign, annotate, and stamp PDFs in your browser.Open the editor

A .json file is plain text, so you can open it on any device that has a text editor. The challenge is reading it comfortably, since many JSON files are one very long line. Here is how to open, read and edit one on each platform.

First, what are you trying to do?

  • Just look at it. Any text editor will show the contents.
  • Understand the structure. You want it indented and ideally with a syntax check.
  • Change a value. You need an editor that saves plain text and does not damage the file.
  • Load it into a spreadsheet. That is a conversion job; see below.

Windows

Right-click the file, choose Open with, and pick Notepad. Notepad displays the raw text and handles reasonably large files. For more help, a code editor shows syntax colouring and can reformat the file. Browsers can also display JSON: drag the file onto a browser window and many will show it, with some offering a collapsible tree view.

Mac

TextEdit can open .json files, but set it to plain text mode first (Format, then Make Plain Text) so it does not save in rich-text format. Smart quotes are the classic Mac pitfall: if TextEdit replaces " with curly quotes the file becomes invalid. Turn off Smart Quotes in the settings, or use a code editor instead.

Android and iPhone

Phones rarely offer a JSON viewer out of the box. On Android, tapping a .json file may offer nothing useful, depending on the file manager. Options are a text editor app, or the browser. The Docento mobile app on Android opens .json files from the file picker, from "Open with" and from Share, shows them in a fixed-width font with a live syntax bar, and lets you edit and use Save a copy. On iPhone, the browser-based route below works in Safari.

In any browser

Open Docento's Text & Markdown Editor, choose your file, and it loads on your device without being uploaded. You get:

  • A fixed-width view of the text
  • A syntax status bar that says "Valid JSON" or names the line where parsing fails
  • A Format JSON button that re-indents the file with two spaces
  • Find, copy and download

Pretty-printing

If your file is a single minified line, formatting makes it readable. See how to format and pretty-print JSON. Formatting changes whitespace only, not the data. Be aware that formatting a file with duplicate keys or very large numbers can lose information in tools that parse the file, because most parsers keep only the last duplicate key and convert big numbers to floating point.

If the file will not open or looks wrong

  • Garbled characters. The file may not be UTF-8. See text file encodings.
  • Everything on one line. It is minified; format it.
  • A syntax error. Look for a missing comma, an extra trailing comma, or single quotes. How to fix invalid JSON lists the common causes.
  • It is huge. Editors load the whole file. Open it in a code editor that handles large files, or split it.
  • It is not really JSON. Some files with a .json extension are JSON Lines, one object per line, which is valid line by line but not as a whole. See JSON with comments, JSON5 and JSON Lines.

Getting JSON into a spreadsheet

Spreadsheet applications do not open JSON natively as a flat table in every version. Common options are an import feature (Excel's Get Data and Power Query can read JSON), a small script, or a converter that flattens the nested structure into rows. Nested arrays have no single obvious table layout, so expect some choices.

Keep a backup before editing

Because JSON is unforgiving, keep a copy of the original before hand-editing, and confirm the syntax check is green before you save over it.

Takeaway

JSON is plain text, so any editor opens it. For readability, use a tool that formats the text and checks the syntax; the Text & Markdown Editor does both in the browser.

Try Docento's free PDF editor

No sign-up, 100% private — sign, annotate, and stamp PDFs in your browser.

Open the editor

Related Posts