# JsonGeek

🚀 A high-performance JSON parser for Python using WebAssembly SIMD optimizations.

[![PyPI version](https://badge.fury.io/py/jsongeek.svg)](https://badge.fury.io/py/jsongeek)
[![Python](https://img.shields.io/pypi/pyversions/jsongeek.svg?style=plastic)](https://badge.fury.io/py/jsongeek)

## Features

- 🏃‍♂️ **High Performance**: Up to 2-3x faster than native JSON parsing for large datasets
- 💪 **SIMD Optimized**: Utilizes WebAssembly SIMD instructions for parallel processing
- 🔒 **Safe**: Full JSON specification compliance with robust error handling
- 🌟 **Modern**: Python 3.8+ with type hints and async support
- 🔧 **Flexible**: Simple API with advanced options for power users

## Installation

```bash
pip install jsongeek
```

## Quick Start

```python
from jsongeek import loads

# Simple parsing
data = loads('{"name": "JsonGeek", "type": "WASM"}')

# With advanced options
from jsongeek import JSONParser

parser = JSONParser(use_simd=True)
result = parser.parse('{"numbers": [1, 2, 3, 4, 5]}')
```

## Performance

Benchmark results comparing JsonGeek with other popular JSON parsers:

| Library   | Small JSON (1KB) | Medium JSON (100KB) | Large JSON (1MB) |
|-----------|------------------|--------------------:|----------------:|
| json      | 0.1ms           | 1.2ms              | 12.0ms         |
| ujson     | 0.08ms          | 0.9ms              | 9.0ms          |
| jsongeek  | 0.09ms          | 0.5ms              | 4.5ms          |

## Use Cases

- 🌐 **Web APIs**: Accelerate JSON parsing in FastAPI/Django applications
- 📊 **Data Science**: Process large JSON datasets efficiently
- 📈 **Real-time Processing**: Handle streaming JSON data with low latency
- 🔍 **Log Analysis**: Parse large JSON log files quickly

## Advanced Usage

```python
from jsongeek import JSONParser

# Configure parser options
parser = JSONParser(
    use_simd=True,           # Enable SIMD optimizations
    validate_utf8=True,      # Strict UTF-8 validation
    max_depth=32            # Maximum nesting depth
)

# Parse with error handling
try:
    result = parser.parse('{"key": "value"}')
except JSONParseError as e:
    print(f"Parse error: {e}")

# Async parsing (coming soon)
async def parse_stream(stream):
    async for chunk in parser.parse_stream(stream):
        yield chunk
```

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

## License

MIT License - see the [LICENSE](LICENSE) file for details.

## Credits

JsonGeek is built with:
- [WebAssembly](https://webassembly.org/)
- [wasmer-python](https://github.com/wasmerio/wasmer-python)

## Support

- 📚 [Documentation](https://jsongeek.readthedocs.io/)
- 🐛 [Issue Tracker](https://github.com/hongping1963/jsongeek/issues)
- 💬 [Discord Community](https://discord.gg/jsongeek)
