A modern web application for viewing and formatting JSON data with a VS Code-style editor interface
- π Monaco Editor: VS Code-style code editor with syntax highlighting, line numbers, and minimap
- π― JSON Formatting: Paste raw or encoded JSON and format it with proper indentation
- π³ Tree View: Interactive tree view with expand/collapse functionality and inline editing
- β Real-time Validation: Live JSON validation with error highlighting
- π Code Folding: Collapse and expand JSON sections
- π¨ Theme Support: Light and dark themes with automatic editor theme switching
- π Search & Replace: Built-in search functionality with regex support
- π Copy to Clipboard: One-click copy of formatted JSON
- π± Modern UI: Clean, responsive design that works on all devices
- π JSON Diff View: Compare two JSON objects side-by-side with highlighted differences
- π·οΈ JavaScript Object Literal Support: Parse and format JavaScript object literal syntax
- π Graph View: Visualize JSON structure as an interactive network graph with D3.js
- π Chart View: Visual representation of data distribution with Chart.js
- πΊοΈ Map View: Display geographical data on an interactive Leaflet map
- π Statistics View: Detailed analysis of JSON data types and structure
- π§ JSON Auto-fix: Automatic correction of common JSON errors
- π 100% Local Processing: All data processing happens in your browserβno data is ever sent to any server
- π¦ Node.js 18.x or later
- π pnpm (recommended) or npm
-
Clone the repository:
git clone <repository-url> cd json-viewer
-
Install dependencies using pnpm (recommended):
pnpm install
Or using npm:
npm install
-
Set up environment variables (optional):
cp .env.example .env.local
Edit
.env.localand add your analytics ID if you want tracking:# Google Analytics (optional) NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXX -
Run the development server:
pnpm dev # or npm run dev -
Open your browser and go to
http://localhost:3000
# Start development server with hot-reload
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run linting
pnpm lintThe project uses ESLint for code quality and consistency:
# Check for linting issues
pnpm lint
# Auto-fix linting issues (when possible)
pnpm lint --fixBuild the application for production:
pnpm buildThis will create an optimized production build with:
- π¦ Optimized bundle sizes
- π Code splitting
- πΌοΈ Image optimization
- β‘ Static asset caching
Start the production server:
pnpm startThe production server will run on http://localhost:3000
json-viewer/
βββ π src/
β βββ π app/ # Next.js App Router
β β βββ π¨ globals.css # Global styles and CSS variables
β β βββ π layout.tsx # Root layout with metadata
β β βββ π page.tsx # Main application page
β βββ π components/ # React components
β β βββ π EditorView.tsx # Monaco Editor integration
β β βββ π³ TreeView.tsx # Interactive JSON tree
β β βββ π GraphView.tsx # D3.js network visualization
β β βββ π ChartView.tsx # Chart.js data visualization
β β βββ πΊοΈ MapView.tsx # Leaflet geographic visualization
β β βββ π DiffView.tsx # JSON comparison tool
β β βββ π StatsView.tsx # JSON statistics analysis
β β βββ π SearchView.tsx # Advanced search functionality
β β βββ ποΈ ControlButtons.tsx # Format/Compact/Copy controls
β β βββ π TabsContainer.tsx # Tab navigation system
β β βββ π― Navbar.tsx # Navigation bar
β β βββ π ThemeProvider.tsx # Theme management
β β βββ π JsonExampleModal.tsx # Example JSON selector
β βββ π hooks/ # Custom React hooks
β β βββ π¨ useTheme.ts # Theme management hook
β β βββ π useNotification.ts # Notification system hook
β βββ π utils/ # Utility functions
β βββ π§ jsonFixer.ts # JSON auto-correction
β βββ π¦ jsonUtils.ts # JSON formatting utilities
β βββ π exampleData.ts # Sample JSON data
βββ π public/ # Static assets
β βββ π img/ # Images and icons
βββ π¦ package.json # Dependencies and scripts
βββ βοΈ tsconfig.json # TypeScript configuration
βββ π¨ tailwind.config.js # Tailwind CSS configuration
βββ π postcss.config.js # PostCSS configuration
βββ π next.config.js # Next.js configuration
Professional-grade code editor with VS Code features including:
- Syntax highlighting for JSON
- Auto-completion and IntelliSense
- Multiple cursors and selection
- Find and replace with regex support
- Code folding and minimap
- Tree View: Navigate complex JSON structures with collapsible nodes
- Graph View: Network visualization using D3.js force-directed graphs
- Chart View: Automatic data type detection and chart generation
- Map View: GeoJSON support with interactive Leaflet maps
- Automatic error detection and correction
- Support for JavaScript object literal syntax
- JSON minification and beautification
- Deep object comparison with diff highlighting
| Variable | Description | Required | Default |
|---|---|---|---|
NEXT_PUBLIC_GA_MEASUREMENT_ID |
Google Analytics Measurement ID (format: G-XXXXXXXXXX) | No | - |
If the analytics ID is not provided, the tracking script will not be loaded, ensuring complete privacy for users who prefer not to use tracking.
Themes are configured in src/app/globals.css using CSS custom properties. The application supports automatic theme switching based on system preferences.
Monaco Editor can be customized in src/components/EditorView.tsx:
- Font size and family
- Tab size and indentation
- Word wrap and line numbers
- Minimap and scrollbar behavior
Deploy to Vercel with one click:
-
Build the application:
pnpm build
-
The build output will be in
.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 - see the LICENSE file for details.
Made with β€οΈ by aduquehd