Replace Hash#to_json and ActiveSupport::JSON to MultiJson #48

Merged
merged 1 commit into from Jun 20, 2012

Projects

None yet

2 participants

@bongole

To be able to select more fast and more space-saving JSON engine.

Space-saving is important for non-ascii utf8 string.
See the following examples.

  • ActiveSupport::JSON
    ActiveSupport::JSON.encode( { "aps" => { "alert" => "あいうえお" } } ) #=> {"aps":{"alert":"\u3042\u3044\u3046\u3048\u304a"}} # 50 bytes

  • MultiJSON with oj engine
    MultiJson.dump( { "aps" => { "alert" => "あいうえお" } ) #=> {"aps":{"alert":"あいうえお"}} # 35 bytes

@ileitch ileitch merged commit cc3b460 into ileitch:master Jun 20, 2012
@ileitch
Owner

Thank you.

@ileitch
Owner

This is failing on REE: http://travis-ci.org/#!/ileitch/rapns/jobs/1666415

Any idea why?

@bongole

Because of ok_json, MultiJson's default JSON engine, converting ActiveSupport::OrderedHash into Hash in internal.
To resolve the failure add 'gem "yajl-ruby"' to Gemfile .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment