Override as_json method to allow gem runnable on Rails