thrift-ut8_json
This gem contains patches for working with thrift struts & JSON serialization/deserialization. Most importantly it contains a fix for encoding handling when using generated thrift JSON blobs inside other objects (e.g. persisting in a data store). This bug is documented in the acceptance test.
Installation
Add this line to your application's Gemfile:
gem 'thrift-utf8_json'
And then execute:
$ bundle
Or install it yourself as:
$ gem install thrift-utf8_json
Usage
thrift-utf8_json adds two classes to the Thrift module:
Thrift::JsonDerserializer & Thrift::JsonSerializer. They mimic the
interface of Thirft::Deserializer & Thrift::Serializer except they
require no arguments to initialize. Here's an example:
require 'thrift-utf8_json'
struct = SomeThriftStruct.new
json = Thrift::JsonSerializer.new.serialize(struct)
deserialized = Thrift::JsonDeserializer.new.deserialize(SomeThriftStruct.new, json)
Testing
$ make test
Contributing
- Fork it ( https://github.com/saltside/thrift-utf8_json-ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request