GitHub

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

Format Validate Tree View Zero Deps 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 .json files 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.

  1. Paste JSON into the input textarea (or drag-and-drop a .json file)
  2. Click Format, Minify, Validate, or Tree
  3. 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"]
Loading

๐Ÿ“ 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.

Read the original on github.com โ†—