Building a Private, Browser-Only JSON Toolkit
Developers paste JSON into online tools all day: API responses, config files, log fragments. Many of those tools send the text to a server, show ads, or hide useful features behind a paywall. The JSON often contains things you would rather not upload. I built JSON Viewer to remove that trade-off: a full JSON toolkit that runs entirely in the browser.
Why I built it
I wanted one place to format, inspect, compare and query JSON without wondering where the data went. The rule I set was simple: JSON content must never leave the browser. Parsing, formatting, querying and schema validation all run client-side. There are no ads and no tracking, and I removed third-party analytics in favour of a small self-hosted counter running on Cloudflare Workers and Durable Objects.
The project started in July 2025 and I am still updating it. It is a single-page app written in TypeScript with React 18 and Vite.
What it does
The app is organised in modes. The core mode pairs an editor with several output views.
Editor and views
- Monaco editor (the engine behind VS Code) with syntax highlighting, bracket matching and live parse-error markers showing line and column.
- Lenient parsing for trailing commas and comments (JSONC), plus a JSON5 mode for unquoted keys and single-quoted strings.
- Tree view with expand and collapse, depth-limited expansion, type icons and a key/item count preview on collapsed nodes. You can double-click a leaf to edit it in place, and the editor updates immediately.
- Table view for arrays of objects, with sortable columns, per-column filters and CSV export.
- Stats view showing node count, maximum depth, estimated size, type distribution and the most frequent keys.
Transforms
Format, minify and recursive key sorting have keyboard shortcuts. A transform menu adds removal of nulls and empty values, flatten to dot-notation keys and back, array deduplication and unique-key extraction.
Diff, query and schema
- Diff uses the Monaco DiffEditor, side-by-side or unified, with a summary of added, removed and modified items computed by jsondiffpatch.
- Query supports JSONPath (via
jsonpath-plus), JMESPath and jq (viajq-web, a WASM build). A Path Explorer sidebar lets you click a path to run it. An optional natural-language mode asks an AI model to write the query, using your own OpenRouter key. - Schema validation uses AJV and supports drafts 4, 6, 7, 2019-09 and 2020-12.
Sharing
The Share button compresses the JSON with LZ-string and puts it in the URL fragment (#json=...). Fragments are not sent to servers, so the payload stays private. Larger documents are stored through paste.rs and shared as a short link. Adding ?embed=1 gives an output-only view suitable for an iframe.
How it works
The stack is React 18, TypeScript and Vite, with Monaco for editing. Several choices are worth explaining because they apply to any client-side tool.
- Virtualised tree. The tree uses react-window, so only visible rows are rendered. That is what lets documents with 100,000+ nodes stay responsive. Rendering every node as a DOM element would freeze the page.
- Code splitting. The main bundle is about 60 KB gzipped, and the total with every feature loaded stays under 300 KB gzipped. Heavy pieces such as the jq WASM module and the diff editor load only when you open the mode that needs them.
- URL fragments for sharing. Putting compressed data after the
#means no backend is needed and no server ever sees it. The trade-off is URL length, which is why the larger-document fallback exists. - Local storage for settings. The AI key, annotations and locale preference are stored in
localStorage. The key is sent straight from the browser to OpenRouter, and only if you use the AI tab. - Self-hosted counter. A Cloudflare Worker with a Durable Object provides a live counter, avoiding any third-party analytics script.
The repository also contains a VS Code extension, a Chrome/Firefox browser extension and a separate Worker called Blackboard, so the same tooling reaches other places developers work.
What I learned
- Privacy is an architecture decision. Deciding early that nothing is uploaded removed whole categories of work: no accounts, no storage, no data-handling policy beyond a short pledge.
- Virtualisation is not optional for trees. Large JSON is common, and a naive recursive render fails quickly.
- Bundle discipline matters. A Monaco-based app can easily become heavy. Lazy loading per mode kept initial load under a second on a modern connection.
- Existing libraries cover a lot. AJV, jsondiffpatch, jsonpath-plus, JMESPath and jq-web gave me three query languages and full schema support without writing parsers myself.
- Keep the AI optional. The natural-language query feature only works with a user-supplied key, so the core tool stays fully offline-capable in spirit and private by default.
Try it
The app is live at https://irjson.com. Paste some JSON, press Ctrl/Cmd + Enter to format it, and switch between the tree, table and stats views. The source is on GitHub. Questions or feedback can go to hello@iramesh.com.
Conclusion
JSON Viewer is my attempt at a tool I can trust with real data: fast, free and local. If you build something similar, start from the privacy rule, virtualise anything large, and split your bundle by feature. Those three decisions shaped most of this project.
Live: https://irjson.com