Add the with_json_root support in to_json.