adopting to_json