Use as_json rather than to_json