Clone this wiki locally

Configuring Formats

RABL supports configuring multiple formats as shown below:

Message Pack

Rabl also includes optional support for Message Pack serialization format using the msgpack gem.
To enable, include the msgpack gem in your project's Gemfile. Then use Rabl as normal with the msgpack format (akin to json and xml formats).

# Gemfilegem'msgpack', '~> 0.4.5'

One can additionally use a custom Message Pack implementation by setting the Rabl msgpack_engine configuration attribute. This custom message pack engine must conform to the MessagePack#pack method signature.

NOTE: Attempting to render the msgpack format without either including the msgpack gem
or setting a msgpack_engine will cause an exception to be raised.

BSON

Rabl also includes optional support for BSON serialization format using the bson gem.
To enable, include the bson gem in your project's Gemfile. Then use Rabl as normal with the bson format (akin to json and xml formats).

NOTE: Attempting to render the bson format without either including the bson gem or
setting a bson_engine will cause an exception to be raised.

Plist

Rabl also includes optional support for Plist serialization format using the plist gem.
To enable, include the plist gem in your project's Gemfile. Then use Rabl as normal with the plist format (akin to other formats).

# Gemfilegem'plist'

There is also an option for a custom Plist implementation by setting the Rabl plist_engine configuration attribute.