I've been experimenting with RubyOnRails API project. My project is not large, it is simply a toy project having a couple of tables with two associations.
All my responses are rendered n jon format using oj gem like this render json: Oj.dump({...}), status: ok. Everything works fine.
On the other hand we have a bunch of libraries such as ActiveModelSerialization, jsonapi-rb, fast_jsonapi, etc.
My question is: why do we need these libs if we simply render json:...? What do these libs do what render json:... can't do? Is it performance?
And my second question. Could you please suggest how I can benchmark these libs in Ruby (on Rails) (best practice)?