TreeJSON
A beautiful, lightweight JSON viewer with syntax highlighting and collapsible tree structure - built with pure JavaScript. β¨ Color-coded syntax highlighting. ποΈ Collapsible nodes for easy navigation. π Error detection with line highlighting.π± Zero dependencies & mobile-friendly design.
Install / Use
/learn @ferhatgnlts/TreeJSONREADME
TreeJSON - Interactive JSON Viewer
TreeJSON is a beautiful, interactive JSON viewer with syntax highlighting, collapsible nodes, and line numbers. It's built with pure HTML, CSS, and JavaScript.
Features
- π¨ Syntax highlighting for keys, strings, numbers, booleans, and null values
- π³ Collapsible/expandable tree structure for easy navigation
- π’ Line numbers for better readability
- π¨ Error handling with highlighted error lines
- π± Responsive design that works on desktop and mobile
- π No dependencies - pure vanilla JavaScript
Installation
No installation needed! Just clone the repo and open index.html in your browser:
git clone https://github.com/ferhatgnlts/treejson.git
cd treejson
open index.html
Usage
- Replace the sample JSON in
js/script.jswith your own JSON data - Open
index.htmlin your browser - Interact with the JSON by clicking the
+/-buttons to collapse/expand nodes
Customization
You can easily customize the color scheme by editing the CSS variables in css/style.css:
:root {
--bg-color: #f5f5f5;
--text-color: #333;
--key-color: #9c27b0;
--string-color: #4caf50;
--number-color: #2196f3;
--boolean-color: #ff9800;
--null-color: #f44336;
--bracket-color: #555;
}
How It Works
- The JSON is parsed and converted to a DOM structure
- Each node is rendered with appropriate syntax highlighting
- Collapsible sections are implemented with CSS and JavaScript
- A MutationObserver watches for changes to update line numbers
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
MIT Β© 2025 [Ferhat GΓΆnΓΌltaΕ]
