A professional, fast, and feature-rich JSON formatting tool built with vanilla JavaScript
π Live Demo β’ π Documentation β’ π Report Bug β’ π‘ Request Feature
- β¨ Features
- π Quick Start
- π οΈ Usage
- β¨οΈ Keyboard Shortcuts
- ποΈ Architecture
- π Deployment
- π οΈ Technologies
- π± Browser Support
- π€ Contributing
- π License
- π JSON Formatting - Convert minified JSON to beautifully formatted, readable code
- π JSON Validation - Real-time syntax validation with detailed error reporting
- π¦ JSON Minification - Compress JSON to reduce file size
- π¨ Syntax Highlighting - Color-coded JSON elements for better readability
- π§ Auto-Fix Errors - Automatically correct common JSON syntax issues
- π Clipboard Integration - One-click copy/paste functionality
- πΎ File Export - Download formatted JSON as
.json
files - π File Upload - Upload and process JSON files directly
- π URL Loading - Load JSON data from remote URLs
- π³ Tree View - Interactive hierarchical view of JSON structure
- π Search & Filter - Find specific keys or values within JSON
- π Statistics - View file size, depth, key count, and array statistics
- βοΈ Customizable Options - Sort keys, multiple indent options, and JSON standards
- β¨οΈ Keyboard Shortcuts - Power user shortcuts for faster workflow
- π± Responsive Design - Optimized for desktop, tablet, and mobile devices
- π Modern UI - Clean, professional interface with smooth animations
- π« No Dependencies - Pure vanilla JavaScript, no frameworks required
- β‘ Fast Performance - Optimized for large JSON files
- π Privacy-First - All processing happens client-side, no data sent to servers
- βΏ Accessibility - WCAG compliant with keyboard navigation support
- π Multiple JSON Standards - Support for RFC 8259, RFC 7159, RFC 4627, and ECMA-404
- π― Flexible Indentation - 2, 3, 4 spaces or tab indentation options
Visit the live application: https://koniz-dev.github.io/json-formatter
# Clone the repository
git clone https://github.com/koniz-dev/json-formatter.git
cd json-formatter
# Open in browser (no build process required)
open index.html
# or
python -m http.server 8000
# then visit http://localhost:8000
- Input: Paste, type, upload, or load JSON from URL
- Format: Click "Format JSON" or press
Ctrl+Enter
- Output: View the formatted result with syntax highlighting
- Input: Enter JSON to validate
- Validate: Click "Validate" button
- Result: See validation status with error details if invalid
- Auto-Fix: Enable auto-fix to automatically correct common errors
- π Manual Input: Type or paste JSON directly
- π File Upload: Click "Upload File" to select a
.json
file - π URL Loading: Click "Load URL" to fetch JSON from a remote URL
- π‘ Example: Click "Example" to load sample JSON data
- Sort Keys: Automatically alphabetize object keys
- Indentation: Choose 2, 3, 4 spaces or tab indentation
- JSON Standard: Select from RFC 8259, RFC 7159, RFC 4627, or ECMA-404
- Auto-Fix Errors: Automatically correct common JSON syntax issues
- Minify: Compress JSON to minimal size
- π³ Tree View: Switch to interactive hierarchical view
- π Search: Find specific keys or values within JSON
- π Statistics: View file size, depth, key count, and array statistics
- Copy: Copy formatted JSON to clipboard
- Download: Save as
.json
file
Shortcut | Action | Description |
---|---|---|
Ctrl+Enter |
Format JSON | Format the current input |
Ctrl+K |
Clear All | Clear input and output |
Ctrl+Shift+C |
Copy Result | Copy output to clipboard |
Ctrl+V |
Paste | Paste from clipboard (when input focused) |
Ctrl+U |
Upload File | Open file upload dialog |
Ctrl+L |
Load URL | Open URL loading modal |
Ctrl+F |
Search | Focus search input |
Ctrl+T |
Tree View | Toggle tree view mode |
Ctrl+E |
Example | Load example JSON |
Escape |
Close Modal | Close any open modal |
json-formatter/
βββ π index.html # Main application structure
βββ π¨ styles.css # Responsive styling and animations
βββ β‘ script.js # Core application logic
βββ π README.md # Project documentation
βββ π LICENSE # MIT License
βββ π« .gitignore # Git ignore rules
βββ πΌοΈ favicon/ # Favicon assets
βββ favicon.ico
βββ favicon-16x16.png
βββ favicon-32x32.png
βββ apple-touch-icon.png
βββ site.webmanifest
- JSONFormatter Class: Main application controller with comprehensive functionality
- Syntax Highlighter: Custom JSON syntax highlighting engine
- Error Handler: Comprehensive error reporting system with auto-fix capabilities
- Clipboard Manager: Cross-browser clipboard integration
- File Exporter: Client-side file download functionality
- URL Loader: Remote JSON fetching with CORS handling
- File Upload Handler: Local file processing and validation
- Tree View Renderer: Interactive hierarchical JSON visualization
- Search Engine: Real-time JSON content search and filtering
- Statistics Calculator: JSON structure analysis and metrics
- Modal Manager: User interface modal handling
- Toast Notification System: User feedback and status messages
This project is automatically deployed to GitHub Pages:
- Repository: koniz-dev/json-formatter
- Live URL: https://koniz-dev.github.io/json-formatter
- Auto-deploy: Updates automatically on every push to
main
branch
Deploy to any static hosting service:
# Build (no build process needed - just copy files)
cp -r . /path/to/web/server/
# Or use with any static site generator
# Files are ready for Netlify, Vercel, AWS S3, etc.
- HTML5 - Semantic markup and modern web standards
- CSS3 - Advanced styling with Flexbox, Grid, and animations
- Vanilla JavaScript (ES6+) - Modern JavaScript without frameworks
- Web APIs - Clipboard API, File API, Blob API, and Fetch API
- Google Fonts - Inter font family for typography
- Font Awesome 6.0 - Professional icon set via CDN
- CSS Gradients - Modern visual design
- Web App Manifest - PWA capabilities
- Debounced Input - Optimized real-time validation and search
- Efficient Parsing - Fast JSON processing with error recovery
- Minimal DOM Manipulation - Smooth user experience
- Event Delegation - Optimized event handling
- Lazy Loading - Resources loaded on demand
- Memory Management - Efficient tree view rendering
- Caching - Smart caching for URL-loaded content
- Clipboard API - Copy/paste functionality
- File API - File upload and processing
- Blob API - File download generation
- Fetch API - Remote JSON loading
- URL API - URL validation and processing
- History API - Browser history management
Browser | Version | Support |
---|---|---|
Chrome | 60+ | β Full Support |
Firefox | 55+ | β Full Support |
Safari | 12+ | β Full Support |
Edge | 79+ | β Full Support |
IE | 11+ |
- Clipboard API: Modern browsers only (Chrome 66+, Firefox 63+, Safari 13.1+)
- File Download: All supported browsers
- File Upload: All supported browsers
- URL Loading: All supported browsers (with CORS support)
- JSON Parsing: Universal support
- Tree View: All supported browsers
- Search & Filter: All supported browsers
- Statistics: All supported browsers
We welcome contributions! Here's how you can help:
- Check existing issues
- Create a new issue with detailed description
- Include browser version and steps to reproduce
- Open an issue
- Describe the feature and its benefits
- Use the "enhancement" label
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Test thoroughly
- Commit:
git commit -m 'Add amazing feature'
- Push:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow existing code style
- Add comments for complex logic
- Test on multiple browsers
- Ensure responsive design
- Update documentation if needed
This project is licensed under the MIT License - see the LICENSE file for details.
β If you found this project helpful, please give it a star!