Format, validate, and beautify your JSON with real-time syntax highlighting and professional features.
Try it now at prettyjson.vishkx.com
- Real-time Formatting β Automatically formats and validates JSON as you type
- Syntax Highlighting β Beautiful code highlighting powered by Monaco Editor
- Pretty Print & Minify β Toggle between beautified and minified JSON output
- JSON5 Support β Export to JSON5 format with comments and trailing commas
- Customizable Indentation β Configure indent size (2, 4, or custom spaces)
- Error Detection β Instant validation with clear error messages
- Monaco Editor β VS Code's powerful editor with IntelliSense and auto-completion
- Resizable Panels β Drag to resize editor and output panes on desktop
- Dark/Light Mode β System-aware theme with animated toggle
- Word Wrap Toggle β Enable/disable word wrapping in the editor
- Fullscreen Mode β Expand the editor to fullscreen for focused editing
- Skeleton Loaders β Professional loading states for smooth UX
- File Upload β Import JSON files directly via file picker
- Drag & Drop β Drop JSON files onto the editor
- Paste Example β Load sample JSON to explore features
- Clear Input β One-click clear button
- Interactive Tree View β Collapsible/expandable JSON tree with search
- Copy to Clipboard β Quickly copy formatted output
- Download β Export as
.jsonor.json5files with custom filename - Share Links β Generate shareable URLs with expiring links (1 hour, 1 day, 1 week)
- Customizable Display β Toggle data types, object sizes, font size, and more
- Installable β Add to home screen on mobile or desktop
- Offline Support β Works without an internet connection
- Responsive Design β Optimized for mobile, tablet, and desktop
- Sort Keys β Alphabetically sort object keys for consistency
- Escape/Unescape Strings β Handle escaped JSON strings
- Keyboard Shortcuts Help β In-app modal showing all shortcuts (
?key) - Sync Editor and Output Pane Themes β Ensure both panes follow the selected global theme
- Responsive Dialogs β Improve UX by using popovers on desktop and drawers on mobile
- Fetch from URL β Import JSON directly from an API endpoint
- JSON Repair β Auto-fix common errors (trailing commas, unquoted keys, single quotes)
- Recent History β Store and access last 5 JSONs in localStorage
- Flatten/Unflatten β Convert nested objects to flat key-value pairs
- JSON Diff/Compare β Side-by-side comparison of two JSON objects
- JSON Path Query β Filter JSON with JSONPath/JMESPath syntax
- Convert to Other Formats β Export to YAML, CSV, TypeScript interfaces
- JSON Schema Validation β Validate JSON against a schema
- JWT Decoder β Decode and display JWT tokens
- Multiple Tabs β Work with multiple JSON files simultaneously
- Onboarding Tour β Guide new users through features
- Mobile Experience β Improve touch interactions and layout
| Category | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Server Components) |
| Language | TypeScript |
| Styling | Tailwind CSS 4 |
| UI Library | shadcn/ui |
| Code Editor | Monaco Editor |
| JSON Tree View | @uiw/react-json-view |
| State Management | Zustand |
| URL State | nuqs |
| Database | Neon PostgreSQL + Drizzle ORM |
| Hosting | Vercel |
This project follows a server-first component architecture:
- Server Components (default) β Layouts, pages, headers, footers, and static content
- Client Components β Only where interactivity is required (editor, tree view, dialogs)
This maximizes performance by:
- Reducing JavaScript bundle size
- Enabling streaming SSR
- Improving initial page load times
- Node.js 20+ (or Bun)
- A Neon PostgreSQL database (for share functionality)
- Clone the repository
git clone https://github.com/vishkx/prettyjson.git
cd prettyjson- Install dependencies
bun install
# or
npm install- Set up environment variables
Copy .env.example to .env and configure:
cp .env.example .envRequired environment variables:
# NeonDB Database Configuration
DATABASE_URL=postgresql://username:password@host.neon.tech/database?sslmode=require
# Cron Job Security (Optional - for Vercel deployment)
CRON_SECRET=your-random-secret-here- Set up the database
bun run db:push
# or
npm run db:push- Run the development server
bun dev
# or
npm run devThen open http://localhost:3000 in your browser.
| Script | Description |
|---|---|
dev |
Start development server |
build |
Create production build |
start |
Start production server |
lint |
Run ESLint |
db:generate |
Generate Drizzle migrations |
db:migrate |
Run database migrations |
db:push |
Push schema changes to database |
db:studio |
Open Drizzle Studio |
src/
βββ app/
β βββ (app)/ # Main application routes
β β βββ (components)/ # Page-specific components
β β β βββ editor-pane.tsx # Monaco editor (client)
β β β βββ output-pane.tsx # JSON tree view (client)
β β β βββ json-formatter.tsx # Main formatter logic (client)
β β β βββ page-header.tsx # Static header (server)
β β β βββ shared-json-loader.tsx # URL share loader (client)
β β βββ layout.tsx # App layout (server)
β β βββ loading.tsx # Loading skeleton (server)
β β βββ page.tsx # Main page (server)
β βββ api/
β β βββ cron/ # Scheduled cleanup jobs
β β βββ share/ # Share link API endpoints
β βββ layout.tsx # Root layout with providers
β βββ manifest.ts # PWA manifest
β βββ robots.ts # SEO robots.txt
β βββ sitemap.ts # SEO sitemap
βββ components/
β βββ custom/ # Custom components
β β βββ skeletons.tsx # Skeleton loaders (server)
β β βββ animated-theme-toggler.tsx
β β βββ theme-color-toggle.tsx
β β βββ ...
β βββ dialogs/ # Dialog components (share, download)
β βββ layout/ # Header & footer (server)
β βββ seo/ # SEO components
β βββ ui/ # shadcn/ui components
βββ db/
β βββ index.ts # Database connection
β βββ schema.ts # Drizzle schema definitions
βββ hooks/ # Custom React hooks
βββ lib/
β βββ config.ts # Site configuration & SEO
β βββ monaco.ts # Monaco editor setup
β βββ utils.ts # Utility functions
βββ services/ # API service functions
βββ stores/ # Zustand state stores
β βββ settings-store.ts # User preferences
β βββ share-store.ts # Share functionality state
βββ context/ # React context providers
| Shortcut | Action |
|---|---|
Ctrl/Cmd + Enter |
Format JSON |
Ctrl/Cmd + M |
Minify JSON |
- Push your code to GitHub
- Import the repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy!
This is a standard Next.js application and can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- Docker / self-hosted
For platform-specific instructions, see the Next.js deployment docs.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some 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.
Created and maintained by vishkx.
- Monaco Editor for the powerful code editor
- @uiw/react-json-view for the interactive JSON tree view
- shadcn/ui for beautiful UI components
- Neon for serverless PostgreSQL
- Vercel for hosting
Made with β€οΈ for the developer community
