https://github.com/latifbaihaki/json-formatter-validator
A beautiful JSON formatter, validator, and converter tool
https://github.com/latifbaihaki/json-formatter-validator
data-converter developer-tools frontend json json-converter json-formatter json-parser json-validator json-viewer monaco-editor open-source react tailwindcss typescript vite web-tool yaml
Last synced: 2 months ago
JSON representation
A beautiful JSON formatter, validator, and converter tool
- Host: GitHub
- URL: https://github.com/latifbaihaki/json-formatter-validator
- Owner: latifbaihaki
- License: mit
- Created: 2025-12-16T03:18:41.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-16T03:20:22.000Z (6 months ago)
- Last Synced: 2025-12-21T18:46:06.435Z (6 months ago)
- Topics: data-converter, developer-tools, frontend, json, json-converter, json-formatter, json-parser, json-validator, json-viewer, monaco-editor, open-source, react, tailwindcss, typescript, vite, web-tool, yaml
- Language: TypeScript
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSON Formatter & Validator
Ever found yourself staring at a wall of unformatted JSON, trying to figure out what's wrong? Or maybe you need to quickly convert JSON to YAML for a config file, or export it as CSV for your spreadsheet? This tool is here to make your life easier.
It's a clean, fast, and powerful web application that handles all the JSON tasks you throw at it. Whether you're debugging API responses, cleaning up messy data files, or just need to format some JSON quickly, this tool has your back.
## Why This One?
Sure, there are tons of JSON formatters online. But most of them feel clunky, slow, or just plain ugly. This one? We built it to actually be pleasant to use. It's fast, it looks good, and it does exactly what you need without getting in your way.
### ✨ Key Features
**Format & Validate**
- Real-time JSON validation with detailed error messages
- Prettify your JSON with customizable indentation (2 spaces, 4 spaces, or tabs)
- Minify JSON to reduce file size
- Syntax highlighting powered by Monaco Editor (the same editor that powers VS Code)
**Convert to Other Formats**
- Convert JSON to YAML for configuration files
- Export to CSV for spreadsheet applications
- Transform to XML when you need it
- All conversions happen instantly as you type
**Tree View**
- Visualize your JSON structure in an interactive tree
- Expand and collapse nodes to navigate large files
- Search through your JSON structure
- Copy paths to specific values with one click
**Developer-Friendly**
- Upload JSON files directly from your computer
- Download formatted or converted files
- Copy to clipboard with a single click
- Load sample JSON to get started quickly
- Dark mode for those late-night coding sessions
## Getting Started
### Prerequisites
First things first - you'll need Node.js installed. Any version 16 or higher will work, but we recommend grabbing the latest LTS version from [nodejs.org](https://nodejs.org/). It comes with npm bundled, so you're all set once you install it.
### Installation
Getting this up and running is pretty straightforward:
1. Clone the repository (or download it if you prefer):
```bash
git clone https://github.com/yourusername/json-formatter-validator.git
cd json-formatter-validator
```
2. Install all the dependencies:
```bash
npm install
```
This might take a minute or two, depending on your internet connection. Grab a coffee while it downloads everything.
3. Fire up the development server:
```bash
npm run dev
```
4. Open your browser and head to `http://localhost:5173` (or whatever port Vite tells you)
And that's it! You should see the app running in your browser. If something goes wrong, check the terminal for any error messages.
### Building for Production
Ready to put this online? Building for production is just one command:
```bash
npm run build
```
This creates an optimized version of the app in the `dist` folder. You can deploy this folder to pretty much any static hosting service - Vercel, Netlify, GitHub Pages, or even your own server. Just upload the contents of the `dist` folder and you're good to go.
## How to Use
The interface is pretty intuitive, but here's a quick walkthrough to get you started:
### Basic Formatting
Just paste your JSON into the editor and watch the magic happen. The tool automatically checks if your JSON is valid as you type - you'll see a green checkmark if everything's good, or a helpful error message if something's wrong.
Want to make it pretty? Click "Prettify" and it'll format everything nicely. Need to save space? Hit "Minify" to compress it. You can also adjust the indentation (2 spaces, 4 spaces, or tabs) to match whatever style your project uses.
### Converting JSON
Need to convert your JSON to something else? Easy. First, make sure it's valid (that green checkmark again). Then just pick your format from the dropdown - YAML for config files, CSV for spreadsheets, or XML if that's what you need. The conversion happens instantly, and you can download or copy the result right away.
### Using the Tree View
Working with a big, nested JSON structure? Switch to Tree View to see it all laid out nicely. You can expand and collapse sections, search for specific keys or values, and even copy the path to any value with one click. Super handy when you're trying to figure out where something is buried in a deep object.
### Working with Files
- **Upload**: Got a JSON file on your computer? Just click "Upload" and select it. The tool will load it right into the editor.
- **Download**: Want to save your formatted or converted JSON? Click "Download" and it'll save to your computer with the right file extension.
- **Copy**: Need to paste it somewhere else? One click on "Copy" and it's in your clipboard.
## Project Structure
```
json-formatter/
├── src/
│ ├── components/ # React components
│ │ ├── JsonEditor.tsx # Monaco editor wrapper
│ │ ├── JsonTreeView.tsx # Interactive tree visualization
│ │ ├── FormatOptions.tsx # Formatting controls
│ │ ├── ValidationPanel.tsx # Error display
│ │ ├── ConvertOptions.tsx # Conversion controls
│ │ ├── ActionButtons.tsx # Copy, download, upload buttons
│ │ └── Layout.tsx # Main layout component
│ ├── utils/ # Utility functions
│ │ ├── jsonFormatter.ts # Formatting logic
│ │ ├── jsonValidator.ts # Validation logic
│ │ ├── jsonConverter.ts # Conversion logic
│ │ └── downloadHelper.ts # File download utilities
│ ├── hooks/ # Custom React hooks
│ │ ├── useJsonEditor.ts # Main state management
│ │ └── useLocalStorage.ts # Local storage persistence
│ ├── types/ # TypeScript definitions
│ └── App.tsx # Main app component
├── public/ # Static assets
└── package.json # Dependencies and scripts
```
## Technologies Used
- **React 18** - Modern React with hooks
- **TypeScript** - Type safety and better developer experience
- **Vite** - Lightning-fast build tool and dev server
- **Monaco Editor** - The same editor that powers VS Code
- **Tailwind CSS** - Utility-first CSS framework
- **js-yaml** - YAML conversion
- Custom browser-compatible implementations for CSV and XML conversion
## Contributing
Found a bug? Have an idea for a new feature? We'd love your help! Every contribution, no matter how small, makes this tool better.
Here's the process:
1. Fork the repository to your own GitHub account
2. Create a new branch for your changes (`git checkout -b feature/your-awesome-feature`)
3. Make your changes and test them
4. Commit with a clear message (`git commit -m 'Add feature: description here'`)
5. Push to your fork (`git push origin feature/your-awesome-feature`)
6. Open a Pull Request and describe what you changed
Try to keep your code style consistent with what's already there, and if you're adding new features, test them out first!
## Common Issues & Solutions
**"JSON is invalid" but it looks correct to me!**
This happens more often than you'd think. Common culprits:
- Trailing commas (JSON doesn't allow them, unlike JavaScript)
- Single quotes instead of double quotes (JSON requires double quotes)
- Unquoted keys (they need to be in quotes too)
**Conversion isn't working**
First, make sure your JSON is actually valid (look for that green checkmark). For CSV conversion specifically, your JSON needs to be either an array of objects or a single object. If you're working with a really large file, give it a second - it might just need a moment to process.
**The editor looks broken or weird**
Try a hard refresh (Ctrl+F5 or Cmd+Shift+R). If that doesn't work, clear your browser cache. And make sure you're using a reasonably modern browser - Chrome, Firefox, Safari, or Edge should all work fine.
## License
This project is open source and available under the [MIT License](LICENSE).
## Acknowledgments
- Built with [Monaco Editor](https://microsoft.github.io/monaco-editor/) by Microsoft
- Styled with [Tailwind CSS](https://tailwindcss.com/)
- Powered by [Vite](https://vitejs.dev/)
---
Made with ❤️ for developers who just want their JSON to work properly, without the hassle.
If this tool saves you time or makes your life easier, a star on GitHub would mean the world to us!