fast_jsonparser
fast_jsonparser copied to clipboard
.optimize_rails() ?
Oj has a very nice Oj.optimize_rails() method that automagically makes Rails use Oj for all it's JSON needs (source: https://github.com/ohler55/oj/blob/develop/pages/Rails.md)
Is there a plan for something as easy to install in Rails for this gem?
There is no such plan but surely it will be a good addition.
Are you interested in adding it ?
oj is a parser and marshaller. (Oj.load, Oj.dump) fast_jsonparser is a parser only.
FWIW: I threw this monkey patch in an initializer:
module ActiveRecord
module Type
class Json < ActiveModel::Type::Value
def deserialize(value)
return value unless value.is_a?(::String)
FastJsonparser.parse(value)
end
end
end
end
We're decoding huge arrays out of Postgres and saw a 5x improvement. Thank you!