A polished, single-file JSON formatter, validator, and tree-view explorer โ all in one HTML page. No build step, no dependencies, deploy anywhere.
๐ Live Demo ยท Features ยท Usage ยท License
โจ Features
- Format โ Pretty-prints JSON with full syntax highlighting (keys, strings, numbers, booleans, null)
- Minify โ Compresses JSON to a single line
- Validate โ Validates JSON syntax with detailed error messages including line & column numbers
- Tree View โ Interactive expandable/collapsible JSON tree with clickable keys
- Drag & Drop โ Drop
.jsonfiles directly onto the page - Copy โ One-click copy of formatted output to clipboard
- Stats โ Real-time character and line counts
- Dark Theme โ Eye-friendly dark UI with orange accent
- Responsive โ Works on desktop and mobile
- Zero Dependencies โ Everything in one HTML file, no CDN, no build tools
๐ Usage
Open index.html in any modern browser, or deploy to GitHub Pages / Netlify / any static host.
- Paste JSON into the input textarea (or drag-and-drop a
.jsonfile) - Click Format, Minify, Validate, or Tree
- Use Copy to grab the formatted output
Keyboard shortcut: Ctrl+Enter / Cmd+Enter to format.
๐ง Pipeline
flowchart LR
A["`Raw JSON Input`"] --> B{"Parse"}
B -- "โ
Valid" --> C["Format / Minify"]
B -- "โ
Valid" --> D["Tree View"]
B -- "โ Error" --> E["Error Display<br>line + column"]
C --> F["Syntax Highlighted Output"]
F --> G["Copy to Clipboard"]
D --> H["Expand / Collapse<br>Interactive Tree"]
๐ Files
json-pretty/
โโโ index.html # Single-file application (~29 KB)
โโโ README.md # This file
๐จ Syntax Highlighting
| Token | Color | Example |
|---|---|---|
| Keys | Orange | "name" |
| Strings | Blue | "hello" |
| Numbers | Cyan | 42, 3.14 |
| Booleans | Purple | true, false |
| Null | Purple | null |
๐ License
Licensed under the MIT License.