Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add msgpack serialization format #68

byu opened this Issue · 5 comments

2 participants


It would be nice to include msgpack as another serialization. It would be a benefit to not have to maintain different rendering processes for json and msgpack in my app.


That's a great idea actually, I am not opposed to adding that as another format. However, I know nothing about msgpack and I do not use it in my apps. If someone wants to write a patch to add a to_msgpack format here: I would much appreciate it.


I think I understand the engine well enough to attempt to add to_msgpack. It would mostly be a clone of Engine#to_json and Engine#format_json.

Question. How to go about the msg pack dependency?

There is a hard dependency, but it wouldn't be so nice for people that don't have it, or want it, installed:
s.add_dependency 'msgpack', '~> 0.4.5'

I think a soft dependency would work out nicely, but with the following warnings:

  • extra gem the user needs to be aware of in order to use.
  • to_msgpack will just error out if msgpack gem isn't installed.

Which way would you like me to proceed?

@byu byu closed this
@byu byu reopened this

Soft dependency with a note in the readme about enabling msgpack support.


Also please add corresponding riot tests if you can (check out existing for inspiration). Thanks, nice to have another format enabled for RABL

@byu byu referenced this issue from a commit
@byu byu Adds optional msgpack serialization format to Rabl.
* Fixes #68 (nesquena/rabl issues tracker)
* Message Pack:
* Defaults to using the Ruby msgpack gem:
* Adds Rabl configuration option `include_msgpack_root` which has same semantics as include_json_root.
* Adds Rabl configuration option `msgpack_engine` which has similar semantics as json_engine.
* Adds whole test suite that is essentially a clone of engine_test.rb, but with proper msgpack expected values.
  Note that I converted the JSON expected values to their msgpack equivalent in this process.
* Updated to reflect the msgpack changes.

I have merged this in. Thanks! 4462ea8

@nesquena nesquena closed this
@ismaelga ismaelga referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.