A powerful Chrome extension and standalone web application for converting between JSON, JSONC (JSON with Comments), and JSON5 formats with advanced editing features and comment preservation.
Install from Chrome Web Store: JSON Format Converter
- Click the link above or visit the Chrome Web Store
- Click "Add to Chrome"
- Click the extension icon in your toolbar to start converting
Try Online: https://idev-sig.github.io/json-format-converter/
No installation required - use directly in your browser!
- Syntax Highlighting: CodeMirror editor with JSON syntax highlighting
- Line Numbers: Easy navigation and debugging
- Auto-completion: Smart bracket matching and auto-closing
- Real-time Validation: Instant error detection and highlighting
- Bidirectional Conversion: JSON β JSONC β JSON5
- Comment Preservation: Maintains comments when converting between JSONC and JSON5
- Same-Format Processing: JSONC β JSONC and JSON5 β JSON5 preserve all comments and formatting
- Intelligent Syntax Handling: Automatic property name quoting/unquoting
- Real-time Conversion: Instant conversion as you type
- Format & Prettify: Beautify and format JSON data
- Compress/Minify: Remove all unnecessary whitespace
- Escape/Unescape: Handle JSON string escaping for embedding
- Data Type Conversion: Convert numbers β strings
- Sort object keys alphabetically (A-Z or Z-A)
- Deep sorting for nested objects
- Preserve or reorganize data structure
- Copy to clipboard with one click
- Download converted files
- Support for multiple file formats
- Configurable indentation (2 spaces, 4 spaces, or tabs)
- Multiple sorting options
- Real-time preview of changes
- Chrome extension for quick access
- Standalone web page for full-featured editing
- Responsive design for desktop and mobile
- Keyboard shortcuts for common actions
- Auto-conversion on input change
- Comprehensive help documentation
- English (Default), Chinese (δΈζ), Japanese (ζ₯ζ¬θͺ), Korean (νκ΅μ΄), German (Deutsch), French (FranΓ§ais), Spanish (EspaΓ±ol), Russian (Π ΡΡΡΠΊΠΈΠΉ), Arabic (Ψ§ΩΨΉΨ±Ψ¨ΩΨ©), Portuguese (PortuguΓͺs) interface
- Automatic Language Detection: Detects browser language preference
- Persistent Settings: Language choice saved in localStorage
- Localized Content: Sample data, help text, and error messages
- Real-time Switching: Change language without page reload
- Help Documentation: Multi-language help and keyboard shortcuts
- JSONC β JSON5: Preserves all comments during conversion
- Same Format: JSONC β JSONC and JSON5 β JSON5 maintain formatting
- Smart Processing: Removes comments only when converting to standard JSON
- Multiple Comment Types: Supports
//
single-line and/* */
multi-line comments
Standard JSON format with strict syntax rules.
JSON format that supports:
- Single-line comments (
//
) - Multi-line comments (
/* */
) - Trailing commas
Extended JSON format that supports:
- Comments (single and multi-line)
- Trailing commas
- Unquoted property names
- Single-quoted strings
- Multi-line strings
- Additional number formats
Download the latest release from GitHub Releases:
- Download
json-format-converter-chrome.zip
- Extract the ZIP file
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the extracted folder
- The extension will appear in your toolbar
- Download
json-format-converter-standalone.zip
- Extract the ZIP file to your web server
- Open
index.html
in any modern web browser - Or deploy the files to any web hosting service
# Clone the repository
git clone https://github.com/idev-sig/json-format-converter.git
cd json-format-converter
# Build all targets (Chrome, Firefox, Standalone)
npm run build
# Or build specific targets
npm run build:chrome # Chrome extension only
npm run build:firefox # Firefox extension only
npm run build:standalone # Standalone web app only
# Files will be generated in dist/ directory
# - dist/chrome/ (Chrome extension)
# - dist/firefox/ (Firefox extension)
# - dist/standalone/ (Web app)
# - *.zip files (Distribution packages)
- Click the extension icon in your toolbar
- Paste your JSON, JSONC, or JSON5 data in the input panel
- Select the input and output formats from the dropdowns
- The conversion happens automatically in real-time
- Use the panel buttons for additional processing
- Copy or download the result from the output panel
- Open the web app in your browser
- Use the same interface with a wider, more comfortable layout
- Perfect for complex editing tasks and bookmarking
- Access comprehensive help documentation
// JSONC β JSON5 (preserves comments)
{
// Configuration settings
"name": "My App",
"version": "1.0.0", // Current version
}
// Converts to:
{
// Configuration settings
name: "My App",
version: "1.0.0", // Current version
}
// JSONC β JSONC (preserves all comments and formatting)
// JSON5 β JSON5 (preserves all comments and formatting)
- Clear: Remove all content from input editor
- Format: Beautify and format the input JSON with proper indentation
- Compress: Minify the input JSON (remove all whitespace)
- Escape: Escape JSON string for safe embedding in code
- Unescape: Remove escape characters from JSON string
- Example: Load localized sample data for the current format
- Copy: Copy formatted output to clipboard with success feedback
- Download: Save output as
.json
file with automatic naming - NumβStr: Convert all numeric values to string format
- StrβNum: Convert numeric strings back to number format
- Ctrl/Cmd + Enter: Format and beautify input
- Ctrl/Cmd + Shift + C: Copy output to clipboard
- Ctrl/Cmd + Shift + D: Download output as file
- Escape: Clear all input and output
- F1: Open help documentation with keyboard shortcuts
- Button States: Active (green) β Success (green) β Normal state transitions
- Real-time Validation: Instant error highlighting and syntax checking
- Status Messages: Clear success/error notifications
- Language Switching: Seamless interface language changes
json-format-converter/
βββ src/ # Source code directory
β βββ manifest.json # Chrome extension manifest
β βββ html/ # HTML files
β β βββ popup.html # Extension popup interface
β β βββ standalone.html # Standalone web page
β β βββ help.html # Help documentation
β βββ css/ # Stylesheets
β β βββ styles.css # Main stylesheet
β βββ js/ # JavaScript files
β β βββ i18n.js # Internationalization
β β βββ converter.js # Core conversion logic
β β βββ popup.js # UI interaction logic
β βββ lib/ # Third-party libraries
β β βββ codemirror.min.js
β β βββ javascript.min.js
β β βββ json5.min.js
β βββ icons/ # Extension icons
β βββ icon.svg # Source icon
β βββ icon16.png # 16x16 icon
β βββ icon32.png # 32x32 icon
β βββ icon48.png # 48x48 icon
β βββ icon128.png # 128x128 icon
βββ scripts/ # Node-based build and dev scripts
β βββ build.js # Production builder (Chrome/Firefox/Standalone)
β βββ dev-server.js # Lightweight dev server
β βββ clean.js # Clean artifacts
β βββ update-libs.js # Update vendored libs (JSON5/CodeMirror)
βββ dist/ # Build output directory
β βββ chrome/ # Chrome extension build
β βββ firefox/ # Firefox extension build
β βββ standalone/ # Standalone web app build
βββ package.json # Project metadata
βββ .gitignore # Git ignore rules
βββ README.md # This file
- Node.js 18+ and npm
- Modern web browser
- ImageMagick (only if you want to rebuild icons)
# Clone the repository
git clone https://github.com/idev-sig/json-format-converter.git
cd json-format-converter
# Start development server
npm run dev
# Build for production (Chrome + Firefox + Standalone)
npm run build
# Build a specific target
npm run build:chrome
npm run build:firefox
npm run build:standalone
# Update vendored libraries (JSON5/CodeMirror)
npm run update:libs
# Clean artifacts
npm run clean
- Edit Source: Modify files in the
src/
directory - Live Development:
npm run dev
then openhttp://localhost:8080/standalone.html
- Extension Testing: Build first, then load in
chrome://extensions/
orabout:debugging
- Package: Zip files are produced automatically in project root
# Development
npm run dev # Start development server (default: 8080)
# Building
npm run build # Build all targets
npm run build:chrome
npm run build:firefox
npm run build:standalone
# Utilities
npm run update:libs # Update JSON5/CodeMirror from jsDelivr
npm run clean # Remove dist and archives
If you need to regenerate icons from the SVG source:
# Requires ImageMagick
cd src/icons
convert icon.svg -resize 16x16 icon16.png
convert icon.svg -resize 32x32 icon32.png
convert icon.svg -resize 48x48 icon48.png
convert icon.svg -resize 128x128 icon128.png
- Vanilla JavaScript: No framework dependencies for maximum compatibility
- CodeMirror 5: Advanced code editor with syntax highlighting
- JSON5: Extended JSON parsing with comment support
- CSS3: Modern styling with flexbox and grid layouts
- Node.js: Cross-platform build system (Windows, Linux, macOS)
- NPM Scripts: Standard package management and build commands
- Chrome/Firefox Extension APIs
- Web APIs: Clipboard, File Download, LocalStorage
- ES6+ Features: Modern JavaScript with broad browser support
- JSON5 β Parser used for JSON5/JSONC compatibility.
- Repo: https://github.com/json5/json5
- File:
src/lib/json5.min.js
- Source CDN: https://cdn.jsdelivr.net/npm/json5@/dist/index.min.js
- CodeMirror 5 β Editor used for syntax highlighting.
- Site: https://codemirror.net/
- Files:
src/lib/codemirror.min.js
,src/lib/codemirror.min.css
,src/lib/javascript.min.js
- Source CDN: https://cdn.jsdelivr.net/npm/codemirror@/(lib|mode/javascript)/...
Update these assets using:
npm run update:libs
# or specify versions
node scripts/update-libs.js --json5 2.2.3 --cm 5.65.16
All thirdβparty files are vendored under src/lib/
for offline/packaged usage.
- Chrome Extension: Chrome 88+ (Manifest V3)
- Standalone Web App: ES6+ modern browsers
- Chrome 88+ β
- Firefox 128+ β
- Safari 14+ β
- Edge 88+ β
- Opera 74+ β
We welcome contributions! Please follow these steps:
- Fork the repository on GitHub
- Clone your fork locally
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and test thoroughly
- Run validation:
node scripts/validate.js
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to your branch:
git push origin feature/amazing-feature
- Submit a pull request
- Follow existing code style and conventions
- Add tests for new features
- Update documentation as needed
- Ensure all validation checks pass
- Test in both extension and standalone modes
Apache 2.0 License - feel free to use this project for personal or commercial purposes.
See LICENSE file for details.
- CodeMirror - Excellent code editor component
- JSON5 - JSON for humans specification and parser
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π§ Contact: Create an issue for any questions
Β© 2025 JSON Format Converter.