Call #as_json when rendering JSON from objects responding to it

This is a common API for objects that have JSON representations, and
resolves circular reference issues with passing some ActiveRecord
models directly to `JSON.dump`.

Signed-off-by: Evan Owen <kainosnoema@gmail.com>