An interactive web application that visualizes JSON data as a hierarchical tree structure using React Flow. Features search functionality, dark mode, and the ability to download visualizations.
π Try it now!
- β JSON Input & Parsing: Text area for pasting JSON with validation and error messages
- β Generate Tree Button: One-click visualization of JSON structure
- β React Flow Visualization: Interactive tree with hierarchical node display
- β
Color-Coded Nodes:
- π΅ Objects: Blue/Purple gradient
- π’ Arrays: Green gradient
- π Primitives: Orange/Yellow gradient
- β
Search Functionality: Search by JSON path (e.g.,
$.user.address.city,items[0].name) - β Highlight & Pan: Matched nodes are highlighted and centered in view
- β Search Messages: "Match found" or "No match found" feedback
- β Dark/Light Mode: Toggle between themes
- β Clear/Reset Buttons: Clear all input or reset to sample JSON
- β Copy JSON Path: Click any node to copy its path to clipboard
- β Download as Image: Export tree visualization as PNG
- β Zoom Controls: Built-in zoom in/out and fit view
- β Pan & Navigate: Drag canvas to explore large trees
- β Hover Information: View node path and value on hover
- β Sample JSON: Pre-loaded example for quick testing
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository
git clone <your-repo-url>
cd Tree- Install dependencies
npm install- Start development server
npm run dev- Open in browser
Navigate to
http://localhost:5173
npm run buildThe built files will be in the dist folder, ready for deployment.
- Paste or type your JSON data in the left panel
- The app includes a sample JSON for quick testing
- Click "Reset Sample" to restore the example
- Click the "Generate Tree" button
- The tree will render with color-coded nodes
- Use zoom controls and drag to navigate
- Enter a JSON path in the search bar:
$.user.name- Access nested object property$.items[0].price- Access array element$.address.city- Deep nested access
- Click "Search" or press Enter
- Matched nodes will be highlighted in red and centered
- Click nodes: Copy the JSON path to clipboard
- Hover nodes: View path and value
- Zoom/Pan: Use controls or mouse gestures
- Download: Export visualization as PNG image
- Click the moon/sun icon to toggle dark/light mode
| Type | Color | Description |
|---|---|---|
| Object | Blue/Purple | JSON objects {} |
| Array | Green | JSON arrays [] |
| Primitive | Orange/Yellow | Strings, numbers, booleans, null |
- React 18: UI framework
- Vite: Build tool and dev server
- React Flow: Graph visualization library
- HTML-to-Image: Download functionality
- CSS3: Styling with gradients and animations
Tree/
βββ src/
β βββ components/
β β βββ CustomNode.jsx # Custom React Flow node component
β β βββ CustomNode.css # Node styling
β βββ utils/
β β βββ jsonToTree.js # JSON parsing and tree building logic
β βββ App.jsx # Main application component
β βββ App.css # Main application styles
β βββ main.jsx # Application entry point
β βββ index.css # Global styles
βββ index.html # HTML template
βββ package.json # Dependencies and scripts
βββ vite.config.js # Vite configuration
βββ README.md # Documentation
npm run build
# Drag the dist folder to Netlifynpm run build
vercel --prod- Update
vite.config.jsbase path to your repo name - Run build and deploy:
npm run build
# Push dist folder to gh-pages branch// Sample JSON
{
"user": {
"name": "John",
"address": {
"city": "NYC"
}
},
"items": [
{ "id": 1, "name": "Laptop" }
]
}
// Search paths:
$.user.name // "John"
$.user.address.city // "NYC"
$.items[0].name // "Laptop"
$ // Root objectContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- React Flow - Graph visualization
- Vite - Build tool
- React - UI framework
For questions or feedback, please open an issue on GitHub.
Made with β€οΈ using React and React Flow
