brianmario/yajl-ruby
FreeA streaming JSON parsing and encoding library for Ruby (C bindings to yajl)
About brianmario/yajl-ruby
yajl-ruby is a Ruby gem providing C bindings to the YAJL (Yet Another JSON Library) for high-performance streaming JSON parsing and generation. It enables parsing and encoding directly from/to IO streams (files, sockets, strings) and supports compressed streams (Bzip2, Gzip, Deflate). The library can handle multiple JSON objects from a single stream or string, and offers a JSON gem compatibility API for drop-in replacement. It also includes a basic HTTP client for GET requests that streams JSON parsing from the response body. Benchmarks show it is approximately 3.5x faster than JSON.generate, 1.9x faster than JSON.parse, and significantly faster than YAML and Marshal operations.
Key Features
Pros & Cons
- High performance due to C bindings to YAJL
- Supports streaming parsing and encoding for memory efficiency
- Handles compressed JSON streams natively
- Easy installation via `gem install yajl-ruby`
- Open source with an active GitHub repository (1.5k stars)
- Only supports HTTP GET requests in the built-in HTTP client (no POST/PUT)
- Requires compilation of native C extension during installation
- Limited to JSON format; no support for other data interchange formats
- May have edge cases with non-standard JSON extensions