A powerful, feature-rich JSON viewer and editor built with Next.js, React, and TypeScript. Transform your JSON data with professional-grade tools including formatting, validation, comparison, and more.
- ๐ JSON Input & Editing - Paste, edit, and manipulate JSON data with real-time validation
- ๐๏ธ Interactive JSON Display - Beautiful, collapsible tree view with syntax highlighting
- ๐ JSON Comparison - Side-by-side comparison of two JSON objects with difference highlighting
- ๐ Statistics Dashboard - Detailed analysis of JSON structure, size, and complexity
- ๐จ Format JSON - Pretty-print with proper indentation and spacing
- ๐ฆ Minify JSON - Compress JSON by removing unnecessary whitespace
- โ Validate JSON - Real-time syntax validation with error reporting
- ๐ง Auto-Fix - Intelligent repair of common JSON formatting issues
- โก Quick Fix - Fast resolution of basic syntax problems
- ๐ Data Transformation - Convert
[object Object]strings to readable format
- ๐ Dark/Light Theme - Toggle between themes with system preference detection
- โจ๏ธ Keyboard Shortcuts - Power user shortcuts for all major functions
- ๐ Copy to Clipboard - One-click copying of formatted JSON
- ๐พ Export JSON - Download JSON files directly to your device
- ๐ Search Functionality - Find specific keys or values within JSON data
- ๐ฑ Responsive Design - Works seamlessly on desktop, tablet, and mobile
- ๐ Smart Parsing - Handles various JSON formats including JavaScript object literals
- ๐ Data Quality Analysis - Identifies potential issues in JSON structure
- ๐ฏ Error Diagnostics - Detailed error messages with suggestions for fixes
- ๐ Real-time Updates - Instant feedback as you type and edit
- Node.js 18+
- npm or yarn
# Clone the repository
git clone https://github.com/your-username/json-viewer.git
cd json-viewer
# Install dependencies
npm install
# Start development server
npm run devOpen http://localhost:3000 to view the application.
# Build the application
npm run build
# Start production server
npm start- Navigate to the View Tab - Click the "View" tab in the main interface
- Paste Your JSON - Enter JSON data in the text area
- View Results - See formatted JSON in the preview panel
- Check Statistics - View detailed information about your JSON structure
- Switch to Compare Tab - Click the "Compare" tab
- Enter Left JSON - Paste the first JSON object
- Enter Right JSON - Paste the second JSON object
- Analyze Differences - View highlighted differences and comparison summary
| Action | Button | Description |
|---|---|---|
| Format | ๐จ Format | Pretty-print JSON with indentation |
| Minify | ๐ฆ Minify | Remove whitespace and compress |
| Validate | โ Validate | Check JSON syntax validity |
| Export | ๐พ Export | Download JSON as file |
| Copy | ๐ Copy | Copy to clipboard |
| Clear | ๐๏ธ Clear | Clear all content |
- Quick Fix โก - Resolves basic syntax issues like trailing commas
- Auto-Fix ๐ง - Handles common formatting problems automatically
- Data Fix ๐ - Transforms
[object Object]strings to readable format
src/
โโโ app/ # Next.js app directory
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Home page
โโโ components/ # React components
โ โโโ json-viewer/ # JSON viewer components
โ โ โโโ CompareView.tsx # Side-by-side comparison
โ โ โโโ JsonDisplay.tsx # JSON tree visualization
โ โ โโโ JsonInput.tsx # Input textarea
โ โ โโโ JsonStatistics.tsx # Statistics panel
โ โ โโโ JsonToolbar.tsx # Action buttons
โ โ โโโ KeyboardShortcuts.tsx # Keyboard handling
โ โ โโโ TabButtons.tsx # Tab navigation
โ โ โโโ ThemeToggle.tsx # Theme switcher
โ โ โโโ ViewTab.tsx # Main view interface
โ โโโ ui/ # Reusable UI components
โโโ hooks/ # Custom React hooks
โ โโโ useJsonViewer.ts # Main application logic
โโโ lib/ # Utility libraries
โ โโโ utils.ts # Helper functions
โโโ utils/ # Application utilities
โโโ constants.ts # App constants
โโโ helpers.ts # JSON processing functions
โโโ types.ts # TypeScript definitions
Central state management for the entire application, handling:
- JSON parsing and validation
- Tab management
- Comparison logic
- Statistics calculation
- Data quality analysis
parseJsonInput- Smart JSON parsing with fallbacksformatJsonString- Pretty-printing with indentationminifyJsonString- Whitespace removalvalidateJsonString- Syntax validationcompareJsonObjects- Deep object comparisongetJsonStatistics- Structure analysis
The application supports both light and dark themes with:
- System Preference Detection - Automatically matches your OS theme
- Manual Toggle - Switch themes with the theme button
- Consistent Design - Tailwind CSS with custom color schemes
- Accessibility - High contrast ratios and readable fonts
The statistics panel provides detailed insights:
- ๐ Type - Object, Array, or primitive type
- ๐ Size - File size in bytes, KB, or MB
- ๐ Keys - Number of object properties
- ๐ Items - Number of array elements
- ๐ Depth - Maximum nesting level
- โ Added - New properties or values
- โ Removed - Deleted properties or values
- ๐ Modified - Changed values with path tracking
- ๐ Summary - Total difference count
- ๐ด Red - Left JSON (removed/changed)
- ๐ข Green - Right JSON (added/changed)
- ๐ก Yellow - Modified values
- Real-time Parsing - Instant feedback as you type
- Error Messages - Clear descriptions of syntax issues
- Common Issues - Helpful suggestions for fixes
- Debug Information - Detailed parsing status
- Trailing Commas - Automatic removal
- Object Literals - JavaScript object support
- String Encoding - Double-encoded JSON handling
- Whitespace - Smart formatting
- โก Fast Parsing - Optimized JSON processing
- ๐ Real-time Updates - Efficient state management
- ๐ฑ Responsive - Smooth performance on all devices
- ๐พ Memory Efficient - Optimized for large JSON files
# Development
npm run dev # Start development server with Turbopack
npm run build # Build for production with Turbopack
npm run start # Start production server
npm run lint # Run ESLint
# Testing (if implemented)
npm run test # Run test suite
npm run test:watch # Run tests in watch mode- Framework: Next.js 15.5.3 with App Router
- UI Library: React 19.1.0
- Styling: Tailwind CSS 4
- Icons: Lucide React
- JSON Viewer: react-json-view-lite
- Notifications: Sonner
- TypeScript: Full type safety
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- react-json-view-lite - For the beautiful JSON tree visualization
- Lucide React - For the comprehensive icon set
- Tailwind CSS - For the utility-first styling approach
- Next.js Team - For the amazing React framework
Made with โค๏ธ using Next.js, React, and TypeScript
โญ Star this repo โข ๐ Report Bug โข ๐ก Request Feature