A modern, fast, and beautiful JSON developer toolkit for Visual Studio Code — format, minify, validate, visualize, diff, convert, search, and clean up JSON without leaving your editor.
Publisher: WhySubaru · Version: 2.0.0
✨ Features
Core
- Pretty Format JSON — Format the current selection or the entire document, with 2-space, 4-space, or tab indentation. Unicode is preserved and large files are handled smoothly.
- Minify JSON — Strip all insignificant whitespace with a single command, without changing the underlying data.
- Validate JSON — Detects invalid JSON, jumps straight to the exact error location, and shows a friendly message with the precise line, column, and character position.
- Copy Formatted JSON — Copies pretty-printed JSON straight to your clipboard with a confirmation notification.
- Format From Clipboard — Reads JSON from your clipboard, formats it, and opens it in a brand-new untitled editor.
- 🌳 JSON Tree Viewer — a collapsible, color-coded tree view of any JSON document. Click any node's "Copy Path" button to grab its path instantly.
- 📍 Copy JSON Path — place your cursor anywhere inside a JSON value and copy its path as dot-notation (
user.addresses[0].city) or JSONPath ($.user.addresses[0].city).
- ⇄ JSON ⇄ YAML Converter — convert JSON to YAML or YAML to JSON in one command, opening the result in a new editor.
- 🔍 JSON Compare/Diff — compare the active document against another JSON file in a dedicated panel: added / removed / changed / unchanged counts plus a full path-by-path breakdown.
- 📊 Enhanced Statistics — objects, arrays, total keys, strings, numbers, booleans, nulls, total size, and maximum nesting depth.
- 🔤 Recursive Key Sorting (A-Z / Z-A) — sort object keys alphabetically in either direction, recursively, with arrays preserving their order.
- 🧹 Remove Duplicate Keys — finds and removes duplicate object keys (keeping the last occurrence), powered by a custom parser that can actually detect duplicates that
JSON.parse silently swallows.
- 💬 Remove Comments (JSONC → JSON) — strips
// and /* */ comments and produces strict, valid JSON.
- 🗑️ Remove Empty Values — recursively remove empty objects (
{}), empty arrays ([]), and/or null values, with a quick-pick to choose exactly what to clean.
- ⚙️ Pretty Print Settings — explicit quick-pick to choose 2 spaces / 4 spaces / tabs.
- 🔎 Search Keys & Values — search across an entire JSON document, with full regex support, and jump straight to any match.
- 🚀 Large JSON Optimization — files above a configurable size threshold (default 5 MB) are formatted and minified on a background worker thread, so the editor UI stays responsive even on 100MB+ files.
Bonus
- ✅ Escape a string into a JSON string literal
- ✅ Unescape a JSON string literal back to raw text
- ✅ Remove trailing commas from lenient/JSONC-like JSON
- ✅ Toggle indentation between 2 spaces, 4 spaces, and tabs
Interface
- 🎨 A modern webview dashboard with a large editor area, rounded action buttons, live valid/invalid status, and one-click access to Tree View, YAML conversion, and Search
- 🌗 Fully dark-mode compatible — uses native VS Code theme colors throughout
- 🟢 A status bar item (
JSON ✓ / JSON ✗) that reflects the active file's validity at a glance — click it to open the dashboard
📸 Screenshots
Add screenshots of the dashboard, tree viewer, diff panel, and status bar here before publishing to the Marketplace.
docs/screenshot-dashboard.png · docs/screenshot-tree.png · docs/screenshot-diff.png · docs/screenshot-statusbar.png
📦 Installation
- Open Extensions in VS Code (
Ctrl+Shift+X / Cmd+Shift+X).
- Search for JSON Formatter Pro by WhySubaru.
- Click Install.
Or install from the command line:
code --install-extension WhySubaru.json-formatter-pro
🚀 Usage
- Open any
.json or .jsonc file.
- Select some JSON (optional) — most commands operate on your selection if one exists, otherwise the whole document.
- Run a command from the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P), the right-click menu, or the status bar.
- For path/tree/search tools, place your cursor where relevant before running the command.
⌨️ Commands
| Command |
Description |
JSON Formatter Pro: Format JSON |
Pretty-print the selection/document |
JSON Formatter Pro: Minify JSON |
Remove all insignificant whitespace |
JSON Formatter Pro: Validate JSON |
Check for JSON errors, jump to the exact location |
JSON Formatter Pro: Copy JSON |
Copy formatted JSON to the clipboard |
JSON Formatter Pro: Show Statistics |
Display key/type counts and size |
JSON Formatter Pro: Open Formatter |
Open the webview dashboard |
JSON Formatter Pro: Format From Clipboard |
Format clipboard JSON into a new editor |
JSON Formatter Pro: Sort Keys Alphabetically |
Recursively sort object keys A-Z |
JSON Formatter Pro: Sort Keys (Z-A) |
Recursively sort object keys Z-A |
JSON Formatter Pro: Escape JSON String |
Escape text into a JSON string literal |
JSON Formatter Pro: Unescape JSON String |
Unescape a JSON string literal |
JSON Formatter Pro: Remove Trailing Commas |
Fix lenient JSON with trailing commas |
JSON Formatter Pro: Toggle Indentation |
Cycle 2 spaces → 4 spaces → tabs |
JSON Formatter Pro: Pretty Print Settings |
Explicitly choose 2 / 4 spaces / tabs |
JSON Formatter Pro: Open Tree Viewer |
Open the collapsible JSON tree view |
JSON Formatter Pro: Copy JSON Path |
Copy the path at the cursor (dot-notation or JSONPath) |
JSON Formatter Pro: Convert JSON to YAML |
Convert JSON → YAML in a new editor |
JSON Formatter Pro: Convert YAML to JSON |
Convert YAML → JSON in a new editor |
JSON Formatter Pro: Compare JSON Files |
Diff the active document against another JSON file |
JSON Formatter Pro: Remove Duplicate Keys |
Remove duplicate object keys |
JSON Formatter Pro: Remove Comments (JSONC to JSON) |
Strip comments, produce strict JSON |
JSON Formatter Pro: Remove Empty Objects/Arrays/Nulls |
Clean up empty/null values |
JSON Formatter Pro: Search Keys/Values |
Regex-capable search with jump-to-match |
On any .json / .jsonc file, right-click in the editor to access:
- Format JSON, Minify JSON, Validate JSON
- Open Tree Viewer, Copy JSON Path, Convert JSON to YAML
On .yaml files: Convert YAML to JSON.
🟢 Status Bar
A JSON ✓ (or JSON ✗ when invalid) indicator appears in the status bar whenever a JSON file is active. Click it to instantly open the dashboard.
⚙️ Settings
| Setting |
Type |
Default |
Description |
jsonFormatter.indentSize |
number (2 or 4) |
2 |
Spaces used for indentation when formatting |
jsonFormatter.sortKeys |
boolean |
false |
Automatically sort object keys alphabetically when formatting |
jsonFormatter.autoValidate |
boolean |
true |
Automatically validate JSON files on open/edit/save |
jsonFormatter.showNotifications |
boolean |
true |
Show success/info notifications for actions |
jsonFormatter.useTabs |
boolean |
false |
Use tabs instead of spaces for indentation |
jsonFormatter.largeFileThresholdMB |
number |
5 |
Files larger than this many MB are processed on a background worker thread |
❓ FAQ
Does it work on huge JSON files?
Yes — files above the configurable large-file threshold (default 5 MB) are formatted and minified on a background Node worker thread, so the editor never freezes, even on 100MB+ files.
What happens if my JSON is invalid?
JSON Formatter Pro never crashes. You'll get a clear error message with the exact line and column, and the editor cursor will jump straight to the problem.
Does formatting change my data?
No. Formatting and minifying only affect whitespace — your data values are never altered (unless you explicitly use Sort Keys or a cleanup command, which only reorder keys or remove empty/duplicate entries as requested).
Can I use this on JSON with comments (JSONC)?
Yes — use Remove Comments (JSONC to JSON) to strip comments and produce strict JSON, or Remove Trailing Commas to clean up lenient JSON before formatting.
How does duplicate key detection work if JSON.parse silently drops duplicates?
JSON Formatter Pro includes its own lightweight, position-aware JSON parser specifically so it can see duplicate keys (and precise error locations) that the native JSON.parse cannot expose.
Is my clipboard or file data sent anywhere?
No. Everything runs 100% locally inside VS Code — nothing is sent over the network.
🧪 Development & Testing
npm install
npm run compile # webpack build (extension.js + jsonWorker.js)
npm run lint # ESLint
npm run test:unit # 60+ unit tests over the core JSON engine and utilities
Press F5 in VS Code to launch an Extension Development Host for manual testing.
📄 License
Released under the MIT License.
💬 Support
Found a bug or have a feature request? Please open an issue on the GitHub repository.
Made with ❤️ by WhySubaru