How to View JSON Files on Mac

Collapsible tree viewers, formatters, and CLI tools for macOS

JSON files are everywhere — API responses, config files, package.json, CloudFormation templates, Terraform state. macOS opens them in TextEdit by default, which shows a wall of unformatted text. Here are five better ways to view JSON on Mac.

Quick Comparison

Tool Type Collapsible Tree QuickLook Price
MDViewer Native Mac app Yes Yes Free (Lite)
VS Code Editor Via extension No Free
Firefox Browser Yes No Free
jq (terminal) CLI tool No No Free
python3 json.tool CLI (built-in) No No Free

1. MDViewer — Collapsible Tree with QuickLook

MDViewer is a native macOS app that renders JSON files as a collapsible tree with syntax highlighting. Open any .json file from Finder and you get a navigable view — click any object or array to expand or collapse it.

Why It Works for JSON

  • Collapsible tree — expand and collapse any branch to focus on what matters
  • Syntax highlighting — strings, numbers, booleans, and null values are color-coded
  • QuickLook preview — press Space on any .json file in Finder to see formatted JSON without opening the app
  • Tabs — open multiple JSON files side by side
  • Search — ⌘F to find keys or values in large files
  • Dark mode — follows macOS system preference

MDViewer also handles Markdown and Mermaid diagrams, so if you work with documentation alongside JSON configs, one app covers both.

Set MDViewer as the Default for .json Files

  1. Right-click any .json file in Finder
  2. Select Get Info
  3. Expand Open with
  4. Choose MDViewer
  5. Click Change All

2. VS Code — View and Edit

VS Code formats JSON automatically with syntax highlighting and code folding. You can collapse objects and arrays by clicking the arrows in the gutter. For a tree view, install extensions like JSON Viewer or JSON Crack.

Useful Shortcuts

  • ⌘⇧PFormat Document — pretty-prints minified JSON
  • ⌘K ⌘0 — fold all (collapse everything)
  • ⌘K ⌘J — unfold all (expand everything)
  • ⌘K ⌘1 through ⌘K ⌘5 — fold to level 1–5

Best for: editing JSON files. VS Code validates JSON syntax, highlights errors, and supports JSON Schema for auto-completion. Heavier than a dedicated viewer for quick inspection.

3. Firefox — Built-in JSON Viewer

Firefox has a built-in JSON viewer. Drag a .json file onto Firefox (or press ⌘O to open) and it renders a formatted, collapsible tree with a search bar and a “Raw Data” toggle.

This is the quickest option if Firefox is already open. No extensions needed — it just works. Chrome and Safari don’t have this feature built in (Chrome shows raw text; Safari may download the file).

4. jq — Terminal Power Tool

jq is a command-line JSON processor. Install it with Homebrew:

brew install jq

Pretty-print a file:

jq . config.json

Extract a specific field:

jq '.dependencies' package.json

Filter an array:

jq '.items[] | select(.status == "active")' data.json

Pipe API responses directly:

curl -s https://api.example.com/data | jq .

Best for: filtering, querying, and transforming JSON from the command line. Essential for working with API responses and log files.

5. python3 json.tool — No Install Required

macOS ships with Python 3. Use the built-in json.tool module for quick formatting:

python3 -m json.tool response.json

Or pipe from another command:

curl -s https://api.example.com/data | python3 -m json.tool

This adds indentation and validates the JSON. It doesn’t support filtering or querying — use jq for that.

Common JSON Tasks on Mac

Inspecting API Responses

Pipe the response through jq for quick terminal viewing, or save it to a file and open in MDViewer for a navigable tree:

curl -s https://api.example.com/data > response.json
open -a MDViewer response.json

Viewing package.json

Large package.json files with dozens of dependencies are hard to read as raw text. Open in MDViewer to collapse dependencies, devDependencies, and scripts independently.

Debugging Config Files

Terraform state, CloudFormation templates, ESLint configs — JSON config files can be hundreds of lines. A collapsible tree lets you drill into the section you need without scrolling through everything.

Frequently Asked Questions

What is the best JSON viewer for Mac?

MDViewer if you want a native app with collapsible tree and QuickLook preview. VS Code if you need to edit. Firefox for quick viewing without installing anything. jq for terminal workflows.

Can I preview JSON in Finder?

Yes — MDViewer adds QuickLook support for .json files. Select a file in Finder, press Space, and see formatted JSON with syntax highlighting. Without a QuickLook plugin, macOS shows raw text.

How do I pretty-print JSON on Mac?

Terminal: python3 -m json.tool file.json (no install) or jq . file.json (after brew install jq). GUI: open in MDViewer or VS Code — both format automatically.

How do I validate JSON on Mac?

python3 -m json.tool file.json prints an error if the JSON is invalid. VS Code highlights syntax errors in real time. jq . file.json also fails on invalid JSON with a descriptive error message.

Can MDViewer handle large JSON files?

MDViewer handles typical JSON files (configs, API responses, package.json) well. For very large files (50 MB+), jq is faster because it streams the data without loading it all into memory.

Try MDViewer

MDViewer renders JSON as a collapsible tree with syntax highlighting and QuickLook preview. Also handles Markdown and Mermaid diagrams. Free to try.

Download MDViewer

Requires macOS 13.0 or later. Intel and Apple Silicon.