A macOS Quick Look extension that provides interactive JSON file previews. Select a .json file in Finder and press Space to get a syntax-highlighted, collapsible tree view instead of plain text.
- Syntax highlighting — keys, strings, numbers, booleans, and null each get distinct colors
- Collapsible tree — click any object or array to collapse/expand, with item count badges
- Search — real-time filtering with match counter and keyboard navigation (Enter/Shift+Enter)
- Expand All / Collapse All — one-click tree manipulation
- Copy Prettified — copies formatted JSON to clipboard
- Dark mode — automatically follows system appearance
- Performance — auto-collapses deep nodes for files with 5000+ nodes
- 10 MB limit — gracefully rejects oversized files
- macOS 14.0+
- Xcode 15+
- XcodeGen (
brew install xcodegen) - An Apple Developer account (free works) signed in to Xcode
# Clone
git clone https://github.com/mjumelet/json-preview.git
cd json-preview
# Install XcodeGen if needed, generate Xcode project
make setup
# Build, install to /Applications, register extension
make installIf the extension doesn't activate, set your Apple Developer Team ID:
make install DEVELOPMENT_TEAM=YOUR_TEAM_IDFind your Team ID in Xcode under Signing & Capabilities, or at developer.apple.com/account → Membership Details.
# Check extension is registered
pluginkit -mDvvv -p com.apple.quicklook.preview | grep -i json
# Test from terminal
qlmanage -p test.jsonOr simply select any .json file in Finder and press Space.
If the preview doesn't appear:
- Open System Settings → Extensions → Quick Look and enable "JSON Preview Extension"
- Reset the Quick Look cache:
qlmanage -r cache && qlmanage -r - Make sure no other JSON preview extension is taking priority
json-preview/
├── project.yml # XcodeGen project spec
├── Makefile # Build/install commands
├── JSONPreview/ # Container app (SwiftUI)
│ ├── JSONPreviewApp.swift
│ └── ContentView.swift
├── PreviewExtension/ # Quick Look extension
│ ├── PreviewProvider.swift # QLPreviewProvider — reads JSON, returns HTML
│ └── Info.plist
├── Resources/
│ └── preview.html # Interactive viewer (HTML/CSS/JS)
└── test.json # Sample JSON for testing
The extension uses the data-based QLPreviewProvider approach:
- Reads the JSON file and validates it
- Base64-encodes the data and injects it into a self-contained HTML template
- Returns the HTML via
QLPreviewReplywithUTType.html - Quick Look renders the HTML with full JavaScript interactivity
The HTML template is a single file with embedded CSS and JavaScript — no external dependencies.
MIT
