`as_json` doesn't return json, it returns a hash. Perhaps replace with `as_hash` or `serialize`?
as_jsondoesn't return json, it returns a hash. Perhaps replace withas_hashorserialize?