https://github.com/vitorhugo-dotnet/pyjsonviewer
https://github.com/vitorhugo-dotnet/pyjsonviewer
json python viewer
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vitorhugo-dotnet/pyjsonviewer
- Owner: vitorhugo-dotnet
- License: mit
- Created: 2025-09-30T20:23:13.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-11-30T16:27:41.000Z (8 months ago)
- Last Synced: 2026-07-06T18:20:37.552Z (9 days ago)
- Topics: json, python, viewer
- Language: Python
- Homepage:
- Size: 70.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyJsonViewer
A beautiful, cross-platform JSON viewer and editor built with Python and PyQt5.
## Features
✨ **Beautiful Interface** - Modern, clean UI with syntax highlighting and tree view
📂 **File Operations** - Open, edit, and save JSON files
📋 **Clipboard Support** - Paste and view JSON directly from clipboard
🌳 **Tree View** - Hierarchical view of JSON structure with expandable nodes
📝 **Raw JSON View** - Formatted JSON text with editing capabilities
🔄 **Auto-formatting** - Automatically format and validate JSON
🖥️ **Cross-platform** - Works on Linux and Windows
⚡ **High Performance** - Lazy loading handles large JSON files efficiently (1+ MB)
## Installation
### Prerequisites
- Python 3.6 or higher
- pip (Python package installer)
### Install Dependencies
```bash
pip install -r requirements.txt
```
Or install PyQt5 directly:
```bash
pip install PyQt5
```
## Usage
### Run the Application
```bash
python json_viewer.py
```
Or make it executable (Linux/Mac):
```bash
chmod +x json_viewer.py
./json_viewer.py
```
### Features Guide
#### Opening JSON Files
- Click "Open File" button or use `File > Open` (Ctrl+O)
- Select a `.json` file from your system
- The JSON will be displayed in both tree and raw views
#### Editing JSON
- Switch to the "Raw JSON" tab
- Edit the JSON text directly
- Use "Format JSON" (Ctrl+F) to auto-format your changes
#### Saving JSON
- Click "Save" button or use `File > Save` (Ctrl+S) to save to current file
- Use `File > Save As` (Ctrl+Shift+S) to save to a new file
#### Using Clipboard
- Copy JSON text to your clipboard
- Click "Paste from Clipboard" or use `Edit > Paste from Clipboard` (Ctrl+V)
- The JSON will be parsed and displayed
#### Tree View
- View JSON structure in a hierarchical tree
- Expand/collapse nodes to navigate complex JSON
- See key-value pairs and data types
#### Raw JSON View
- View and edit JSON as formatted text
- Monospace font for better readability
- Syntax validation on save
## Keyboard Shortcuts
- `Ctrl+O` - Open file
- `Ctrl+S` - Save file
- `Ctrl+Shift+S` - Save as new file
- `Ctrl+V` - Paste from clipboard
- `Ctrl+F` - Format JSON
- `Ctrl+Q` - Exit application
## Performance
pyJsonViewer is optimized for handling large JSON files:
- **Lazy Loading**: Tree view items are loaded on-demand when you expand nodes
- **Fast Initial Load**: Only top-level items are created initially
- **Responsive UI**: No freezing or lag when opening large files
- **Memory Efficient**: Handles files over 1MB without issues
- **99%+ Reduction**: In initial tree items compared to full recursive loading
Perfect for viewing large API responses, configuration files, or data exports!
## Screenshots
The application features:
- Clean, modern interface with green accent color
- Two-tab layout for different views
- Toolbar for quick access to common actions
- Status bar for feedback messages
## Platform Support
### Linux
Fully supported. Install PyQt5 via pip or your distribution's package manager:
- Ubuntu/Debian: `sudo apt-get install python3-pyqt5`
- Fedora: `sudo dnf install python3-qt5`
- Arch: `sudo pacman -S python-pyqt5`
### Windows
Fully supported. Install PyQt5 via pip:
```bash
pip install PyQt5
```
### macOS
Should work but not specifically tested. Install PyQt5 via pip:
```bash
pip install PyQt5
```
## Example JSON Files
Create a test JSON file to try the viewer:
```json
{
"name": "John Doe",
"age": 30,
"email": "john@example.com",
"address": {
"street": "123 Main St",
"city": "New York",
"country": "USA"
},
"hobbies": ["reading", "coding", "gaming"],
"active": true
}
```
## Troubleshooting
### PyQt5 Installation Issues
If you encounter issues installing PyQt5:
1. Make sure you have Python 3.6+ installed
2. Update pip: `pip install --upgrade pip`
3. Try installing with: `pip install PyQt5 --user`
### Display Issues on Linux
If the application doesn't display properly:
- Install Qt platform plugins: `sudo apt-get install qt5-default`
- Set environment variable: `export QT_QPA_PLATFORM=xcb`
## License
MIT License - See LICENSE file for details
## Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
## Author
Vitor Hugo
## Acknowledgments
Built with:
- Python 3
- PyQt5
- Standard JSON library