I would use `#as_json` method here. Also this is violating original `#to_json` method signature.