The approach taken by both the json gem and ActiveSupport is to push JSON encoding to the individual object and then monkey patching those objects to implement encoding and decoding. Oj take a different approach and looks at Ruby objects as data and keeps the endcoding in C instead of going out to each object and encoding in Ruby.