A high-performance streaming JSON parsing and encoding library for Ruby with C bindings to YAJL.
yajl-ruby is a Ruby gem that provides C bindings to the YAJL library, offering high-performance streaming JSON parsing and encoding. It allows developers to process JSON data incrementally from various IO sources like files, sockets, or HTTP streams, significantly reducing memory usage compared to loading entire JSON documents at once.
Ruby developers working with large JSON datasets, real-time data streams, or performance-sensitive applications where efficient memory usage and speed are critical.
Developers choose yajl-ruby for its superior performance and memory efficiency in streaming JSON processing, its drop-in compatibility with the JSON gem, and built-in support for compressed data streams.
A streaming JSON parsing and encoding library for Ruby (C bindings to yajl)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Parses and encodes JSON directly from IO streams like files or sockets, minimizing memory usage—benchmarks show only 32MB average memory for 2.43MB files, compared to 54MB for JSON.parse.
Significantly faster than alternatives, with benchmarks showing ~3.5x faster encoding than JSON.generate and ~1.9x faster parsing than JSON.parse for large datasets.
Built-in support for Gzip, Deflate, and Bzip2 allows parsing and encoding compressed JSON streams without extra libraries, as shown in the HTTP and file examples.
Acts as a drop-in replacement by requiring 'yajl/json_gem', enabling seamless adoption in existing projects that use the standard JSON gem API.
Requires compilation and native libraries, which can fail on systems without proper toolchains or on cloud platforms that restrict C extensions, adding setup complexity.
The built-in HTTP client only supports GET requests, as admitted in the README, making it unsuitable for APIs requiring other methods like POST or DELETE.
Using :symbolize_keys can lead to memory leaks if parsing JSON with unique keys, since Ruby symbols aren't garbage collected, a caveat noted in the streaming API examples.