A modern, privacy-first web app to format, validate, explore, and compare JSON β with a VS Code-style editor and rich visualizations
- π CodeMirror 6 Editor: VS Code-style editing with syntax highlighting, line numbers, and code folding
- π― JSON Formatting: Format with 2 spaces, 4 spaces, or tabs β plus optional AβZ key sorting
- β Real-time Validation: Live validation with inline error highlighting and a status bar (nodes, depth, lines, size)
- π§ JSON Auto-fix: Automatic correction of common errors β trailing commas, single quotes, unquoted keys, missing commas
- π·οΈ JavaScript Object Literal Support: Parse and format JS object literal syntax
- π Clipboard & Files: Copy, paste, open/drag-in
.jsonfiles, and download the result
- π³ Tree View: Interactive collapsible tree with inline editing of keys and values
- π Graph View: Explore JSON as an interactive node-link graph (D3.js) with pan, zoom, and expand/collapse
- π Compare / Diff: Side-by-side compare with split, unified, and semantic modes, "ignore key order", collapse-unchanged, and hunk navigation
- π Statistics View: Key counts, nesting depth, and a full data-type breakdown
- π Search & Filter: Find keys and values across large documents
- πΊοΈ Map View (beta): Plot latitude/longitude data on an interactive Leaflet map
- π Internationalization: UI translated into 12 languages (English, Spanish, Hindi, Turkish, Dutch, Malay, Chinese, Tamil, and more)
- π¨ Theme Support: Light and dark themes with system-preference detection
- π A Real URL per View:
/,/tree,/graph,/stats,/diff,/search,/mapβ reloadable, shareable, and indexable, while the workbench keeps your JSON when switching views - π Guides & Help: Built-in JSON guides (syntax, common errors, JSON vs XML,
JSON.parse, and more) at/guidesand a help page at/help - π± Responsive UI: Works on desktop and mobile
- π 100% Local Processing: Everything runs in your browser β no JSON is ever sent to a server
Taken with the built-in "Try an example JSON" β Financial Sales dataset.
The main editor with formatting toolbar, validation status bar, and the Compare panel ready to open.
Two documents compared side by side β changed lines highlighted, with split/unified/semantic modes and hunk navigation.
Collapsible tree with inline editing β click any key or value to edit it directly.
JSON as an interactive node-link graph β click nodes to expand/collapse, scroll to zoom, drag to pan.
- π¦ Node.js 18.18 or later (20+ recommended)
- π pnpm (primary package manager)
-
Clone the repository:
git clone https://github.com/aduquehd/json-viewer.git cd json-viewer -
Install dependencies:
pnpm install
(This also copies self-hosted editor assets and installs the Lefthook git hooks.)
-
Run the development server (Turbopack):
pnpm dev
-
Open your browser and go to
http://localhost:3000
pnpm dev # Development server with Turbopack
pnpm build # Production build
pnpm start # Start production server
pnpm format # Format code (Biome)
pnpm fix # Auto-fix formatting + safe lint issues + organize imports (Biome)
pnpm lint # Lint Next.js framework rules (ESLint)
pnpm lint:biome # General JS/TS linting (Biome)
pnpm typecheck # Type-check the whole project (tsc --noEmit)
pnpm check # Run every validation at once (Biome + ESLint + tsc)The repo uses a hybrid lint/format setup:
- Biome owns formatting, general JS/TS linting, and import organization (single quotes, 2-space indent, 100 print width)
- ESLint (flat config) runs only the Next.js layer:
next/core-web-vitals(React Hooks,next/image, jsx-a11y) - TypeScript strict mode with
tsc --noEmitfor type safety
A pre-commit hook (installed automatically on pnpm install) runs, in order:
- Biome β formats/lints/organizes imports on staged files (auto-fixes and re-stages)
- ESLint β checks staged JS/TS files against the Next.js rules
tsc --noEmitβ type-checks the project when a TS file is staged
Bypass once with git commit --no-verify if needed.
json-viewer/
βββ π docs/
β βββ π screenshots/ # README screenshots
βββ π public/ # Static assets (manifest, robots.txt, images, self-hosted editor assets)
βββ π scripts/
β βββ π copy-monaco.mjs # Copies editor assets into public/ (no CDN egress)
βββ π src/
β βββ π app/ # Next.js App Router
β β βββ π (app)/ # Workbench views β one URL per view
β β β βββ π page.tsx # / Editor / formatter
β β β βββ π tree/ # /tree Tree view
β β β βββ π graph/ # /graph Graph view
β β β βββ π stats/ # /stats Statistics
β β β βββ π diff/ # /diff Compare / diff
β β β βββ π search/ # /search Search & filter
β β β βββ π map/ # /map Map view
β β β βββ π layout.tsx # Shared shell β keeps editor state across views
β β βββ π api/sitemap/ # Dynamic sitemap (rewritten from /sitemap.xml)
β β βββ π guides/ # JSON guides (what is JSON, syntax, errors, JSON vs XML, β¦)
β β βββ π help/ # Help & documentation page
β β βββ π¨ globals.css # Global styles and CSS theme variables
β β βββ π layout.tsx # Root layout with metadata
β βββ π components/ # React components
β β βββ π CodeMirrorEditor.tsx # CodeMirror 6 integration
β β βββ π₯οΈ EditorWorkspace.tsx # Editor layout + Compare call-to-action
β β βββ π CompareWorkspace.tsx # Diff: split / unified / semantic modes
β β βββ π§° JsonWorkbench.tsx # Central state manager for all views
β β βββ π³ TreeView.tsx # Interactive JSON tree
β β βββ π GraphView.tsx # D3.js node-link visualization
β β βββ π StatsView.tsx # JSON statistics analysis
β β βββ π SearchView.tsx # Search & filter
β β βββ πΊοΈ MapView.tsx # Leaflet geographic visualization
β β βββ ποΈ ControlButtons.tsx # Format / Compact / Copy / Open / Download controls
β β βββ π TabsContainer.tsx # View tabs (synced with the URL)
β β βββ π StatusBar.tsx # Validity, node count, depth, size
β β βββ π LanguageSelector.tsx # 12-language switcher
β β βββ π ThemeProvider.tsx # Theme management
β β βββ π JsonExampleModal.tsx # Sample JSON picker
β β βββ π seo/ # Per-view SEO content (FAQs, HowTo, JSON-LD)
β βββ π hooks/ # useTheme, useNotification
β βββ π lib/ # i18n setup, per-view SEO/routing metadata, gtag
β βββ π locales/ # Translations (12 languages)
β βββ π types/ # Global TypeScript declarations
β βββ π utils/ # jsonFixer, jsonUtils, jsonDiff, exampleData
βββ βοΈ biome.json # Biome formatter/linter config
βββ βοΈ eslint.config.mjs # ESLint flat config (Next.js rules only)
βββ πͺ lefthook.yml # Pre-commit hooks
βββ π next.config.js # Security headers, redirects, sitemap rewrite
βββ π¨ tailwind.config.js # Tailwind CSS configuration
βββ βοΈ tsconfig.json # TypeScript configuration (strict, @/* alias)
Next.js 15 (App Router, Turbopack dev server), React 19, TypeScript in strict mode.
Tailwind CSS with CSS custom properties for theming, Framer Motion animations, Lucide icons, Notyf toasts.
CodeMirror 6 for the JSON editors, D3.js for the force-directed graph, Leaflet + react-leaflet for maps.
i18next + react-i18next with browser language detection β 12 supported languages.
pnpm, Biome, ESLint 9 (flat config), Lefthook git hooks, deployed on Vercel.
- One URL per view, one shared workbench: every view (
/,/tree,/diff, β¦) is a real, indexable page, but they all share a single persistent workbench β your JSON and options survive switching views because the layout instance persists across navigations. - 100% client-side processing: parsing, formatting, fixing, diffing, and visualization all run in the browser. No JSON ever leaves your device.
- Dynamic imports: heavy views (Graph, Compare, Stats, Map) are lazy-loaded so the initial page stays fast.
- SEO built-in: per-view metadata, FAQs, HowTo steps and JSON-LD, a dynamic sitemap (
/sitemap.xmlβ/api/sitemap), and permanent redirects from legacy keyword URLs (e.g./tools/json-formatterβ/). - Hardened headers: CSP, HSTS,
X-Frame-Options: DENY,X-Content-Type-Options: nosniff, strict Referrer-Policy and Permissions-Policy configured innext.config.js. - Self-hosted assets: editor assets are copied into
public/at install/build time β no third-party CDN requests.
Themes are defined in src/app/globals.css using CSS custom properties. The app follows the system preference and persists the user's choice to localStorage.
Google Analytics 4 is only loaded when NEXT_PUBLIC_GA_MEASUREMENT_ID is set; otherwise no analytics code ships.
Deploy to Vercel with one click:
-
Build the application:
pnpm build
-
The build output will be in the
.next/directory -
Deploy using your preferred hosting service that supports Next.js
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Made with β€οΈ by aduquehd



