A Ruby templating system for generating JSON, XML, MessagePack, PList, and BSON API responses in Rails and Padrino.
RABL is a Ruby templating system designed for building API responses in formats like JSON, XML, MessagePack, PList, and BSON. It provides a DSL to define how data should be structured in the view layer, solving the limitations of ActiveRecord's `to_json` by enabling custom nodes, partials, inheritance, and conditional rendering.
Ruby on Rails and Padrino developers who need to generate complex, well-structured API responses and want to keep data representation logic separate from models and controllers.
Developers choose RABL for its expressive templating DSL, multi-format support, and adherence to MVC principles, offering greater control and flexibility over API output compared to built-in serialization methods.
General ruby templating with json, bson, xml, plist and msgpack support
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The Ruby DSL allows for custom nodes, partials, inheritance, and conditional rendering, enabling complex API schemas that don't match the database structure, as shown in examples with child nodes and glue attributes.
Generates responses in JSON, XML, MessagePack, PList, and BSON from the same template, reducing duplication and supporting various client needs without separate templates.
Works with any Ruby object, not just ActiveRecord models, making it flexible for different data sources and decoupling from specific ORMs.
Supports fragment caching to improve performance in production, with configurable cache engines and options for template-level or collection caching.
The README documents breaking changes in versions like v0.9.0 and v0.8.0, which can disrupt production APIs and require careful upgrades.
Numerous global settings for root nodes, key formatting, and nil handling add overhead, and misconfiguration can lead to inconsistent output across formats.
Primarily designed for Rails and Padrino; while Sinatra is supported with extra setup, it's less seamless and not ideal for modern, framework-agnostic microservices.