A fully functional JSON diff comparison application has been implemented based on the specifications in docs/prompt.md.
- ✅ Two side-by-side JSON panels with Monaco Editor
- ✅ Resizable split layout using react-resizable-panels
- ✅ Format Left/Right buttons for JSON validation and formatting
- ✅ Compare button to analyze structural differences
- ✅ Clear button to reset all content
- ✅ Real-time syntax highlighting and validation
- ✅ Structural JSON comparison (parse-first approach)
- ✅ Recursive diff algorithm
- ✅ Detects added, removed, and modified fields
- ✅ Shows full JSON path for each change (e.g.,
user.address.city) - ✅ Color-coded highlights:
- 🟢 Green for added fields
- 🔴 Red for removed fields
- 🟡 Yellow for modified fields
- ✅ POST
/api/format- Validates and formats JSON - ✅ POST
/api/diff- Compares two JSON objects - ✅ Proper error handling and validation
- ✅ TypeScript-based API handlers
- ✅ Clean, developer-focused UI using shadcn/ui
- ✅ Dark mode by default
- ✅ Monospace fonts for code
- ✅ Subtle, non-aggressive colors
- ✅ Collapsible/expandable diff items for complex values
- ✅ Error banner with inline error messages
- ✅ Loading states during API calls
- ✅ Summary statistics (count of added/removed/modified)
- ✅ Responsive layout
- JsonPanel - Monaco Editor wrapper with error display
- ActionBar - Top toolbar with all action buttons
- DiffViewer - Displays structured diff results with color coding
- ErrorBanner - Reusable error message component
- DeltaView - Main app component coordinating all features
- Frontend: React 19, TypeScript
- UI: shadcn/ui (New York style) + Tailwind CSS
- Code Editor: Monaco Editor (VS Code's editor)
- Layout: react-resizable-panels
- Backend: Bun server with API routes
- Runtime: Bun (fast JavaScript runtime)
-
Install dependencies:
bun install
-
Start the development server:
bun run dev
-
Open your browser to the URL shown (typically http://localhost:3000)
- Paste or type JSON into the left and right panels
- Click Format Left or Format Right to validate and format JSON
- Click Compare to see differences between the two JSON objects
- View detailed diff results with paths and values
- Click Clear to reset and start over
- Minimal & Clean - No clutter, just the essentials
- Developer-Focused - Monospace fonts, syntax highlighting
- Accessible - Proper contrast, keyboard navigation
- Performant - Fast JSON parsing and diff algorithms
- Error-Tolerant - Clear error messages, no crashes
src/
├── components/
│ ├── ActionBar.tsx # Top action buttons
│ ├── DiffChecker.tsx # Main DeltaView component
│ ├── DiffViewer.tsx # Diff results display
│ ├── ErrorBanner.tsx # Error message component
│ ├── JsonPanel.tsx # Monaco editor panel
│ └── ui/ # shadcn/ui components
├── lib/
│ ├── diff.ts # Diff algorithm & utilities
│ └── utils.ts # Helper functions
├── frontend.tsx # React entry point
├── index.tsx # Bun server with API routes
├── index.html # HTML template
└── index.css # Global styles
Formats and validates JSON.
Request:
{
"raw": "{'invalid': json}"
}Response (Success):
{
"formatted": "{\n \"valid\": \"json\"\n}"
}Response (Error):
{
"error": "Unexpected token ' in JSON at position 1"
}Compares two JSON objects.
Request:
{
"left": "{\"name\": \"John\"}",
"right": "{\"name\": \"Jane\"}"
}Response:
{
"changes": [
{
"path": "name",
"type": "modified",
"oldValue": "John",
"newValue": "Jane"
}
]
}- Add JSON schema validation
- Support for other data formats (YAML, XML)
- Export diff results
- Share/permalink functionality
- Line-by-line text diff mode
- Collapsible "unchanged sections" in diff view
- Dark/light mode toggle
Status: ✅ Ready for use! Last Updated: 2026-02-14