Thank you all. I went through the documentation page. Looks like :methods is the solution I was looking for.
Read the documentation for #to_json. This should take you about a minute, and the answer should be obvious. Here's a link:
You have to deal with ActiveSupport::JSON.encode operation. One way could be:
h = model.attributes h[:total_amount] = model.total_amount json_model = ActiveSupport::JSON.encode(h)