jsonMore
A command-line tool for reading, formatting, and analyzing JSON files with syntax highlighting, automatic error repair, and smart paging.

Quick Start 🚀
After installation, use the jsonmore
command directly:
pip install jsonmore
echo '{"id": 123, "name": "Jason", "nerd": true}' | jsonmore
jsonmore somefile.json
Installation
For Users (Recommended)
Install globally using your preferred Python package manager:
pip install jsonmore
pipx install jsonmore
uv pip install jsonmore
For Developers
Clone the repository and install in development mode:
git clone https://github.com/yourusername/jsonmore.git
cd jsonmore
pip install -e ".[dev]"
Usage
Command Line Interface
jsonmore file.json
jsonmore large_file.json --max-size 100
jsonmore file.json --no-pager
jsonmore broken.json
jsonmore broken.json --no-repair
jsonmore file.json --indent 4 --no-colors
Command Line Options
--no-colors | Disable color output for plain text |
--max-size N | Maximum file size in MB (default: 50) |
--indent N | Indentation spaces (default: 2) |
--no-pager | Disable automatic paging |
--no-repair | Disable automatic JSON repair |
--verbose | Show headers and JSON structure info |
--help | Show help message and examples |
Python API
You can also use jsonmore as a Python library:
from jsonmore import JSONReader, JSONFormatter
reader = JSONReader()
result = reader.read_file('data.json')
if result['status'] == 'valid':
data = result['data']
print(f"Successfully parsed JSON with {len(data)} keys")
formatter = JSONFormatter(use_colors=True, indent=2)
formatted = formatter.format_json(data)
print(formatted)
🔧 JSON Repair Capabilities
The tool can automatically detect and fix common JSON syntax errors:
Supported Repairs
- Missing quotes around object keys
- Single quotes instead of double quotes
- Trailing commas in objects and arrays
- Missing commas between properties
- JavaScript-style comments (
//
and /* */
)
- Missing braces in nested objects
- Malformed structure patterns
Example Repairs
Before (broken JSON):
{
name: "John",
'age': 25,
"skills": ["Python",],
"active": true,
}
After (auto-repaired):
{
"name": "John",
"age": 25,
"skills": ["Python"],
"active": true
}
Package Structure
For developers and contributors, here's the package organization:
jsonmore/
├── __init__.py # Package initialization and public API
├── cli.py # Command-line interface entry point
├── colors.py # ANSI color definitions
├── core.py # Core JSON processing (JSONReader, JSONFormatter, JSONRepair)
├── utils.py # Utility functions (paging, terminal handling)
└── py.typed # Type hints marker file
Module Overview
jsonmore.cli
: Command-line interface and argument parsing
jsonmore.core
: Main business logic for JSON reading, formatting, and repair
jsonmore.colors
: ANSI color code definitions for terminal output
jsonmore.utils
: Utility functions for paging and terminal interaction
jsonmore
: Public API exports for library usage
Development API
Setting Up Development Environment
git clone https://github.com/yourusername/jsonmore.git
cd jsonmore
pip install -e ".[dev]"
pip install -r requirements-dev.txt
Running Tests
python test_jsonmore.py
pytest test_jsonmore.py -v
Code Quality
black jsonmore/
flake8 jsonmore/
mypy jsonmore/
Error Handling
The tool provides multiple levels of error handling:
- Valid JSON: Normal parsing and display
- Auto-Repair: Attempts to fix common errors
- Partial Parsing: Extracts valid JSON fragments
- Raw Display: Shows content with error highlighting
Color-Coded Output
- Keys: Cyan
- Strings: Green
- Numbers: Yellow
- Booleans: Magenta
- Null: Gray
- Brackets/Braces: White
Error Highlighting
{
"name": "John",
►a◄ge: 30,
"city": "NYC"
}
Contributing
We welcome contributions! Here's how to get started:
- Fork the repository on GitHub
- Create a feature branch:
git checkout -b feature-name
- Make your changes and add tests
- Run the test suite:
python test_jsonmore.py
- Submit a pull request
Guidelines
- Maintain compatibility with Python 3.8+
- Follow the existing code style (use
black
for formatting)
- Add tests for new features
- Update documentation as needed
License
MIT License - see LICENSE file for details.
Acknowledgments
- Built with Python's standard library for maximum compatibility
- Inspired by tools like
jq
, bat
, and less
- Thanks to the JSON specification and repair techniques community
Happy JSON reading!