prefix2str(&rn->p, buf1, sizeof(buf1));
json_route = json_object_new_object();
- if (json) {
+ if (json)
json_object_object_add(json, buf1, json_route);
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_NOSLASHESCAPE);
- }
switch (or->path_type) {
case OSPF_PATH_INTER_AREA:
snprintfrr(buf1, sizeof(buf1), "%pFX", &rn->p);
json_route = json_object_new_object();
- if (json) {
+ if (json)
json_object_object_add(json, buf1, json_route);
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_NOSLASHESCAPE);
- }
switch (er->path_type) {
case OSPF_PATH_TYPE1_EXTERNAL:
if (uj) {
/* Keep Non-pretty format */
vty_out(vty, "%s\n",
- json_object_to_json_string(json));
+ json_object_to_json_string_ext(
+ json,
+ JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json);
} else if (!ospf_output)
vty_out(vty, "%% OSPF instance not found\n");
if (uj) {
vty_out(vty, "%s\n",
json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ json,
+ JSON_C_TO_STRING_PRETTY
+ | JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json);
} else
vty_out(vty, "%% OSPF instance not found\n");
if (uj) {
vty_out(vty, "%s\n",
json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ json,
+ JSON_C_TO_STRING_PRETTY
+ | JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json);
} else
vty_out(vty, "%% OSPF instance not found\n");
ret = show_ip_ospf_route_common(vty, ospf, json, use_vrf);
/* Keep Non-pretty format */
if (uj)
- vty_out(vty, "%s\n", json_object_to_json_string(json));
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_NOSLASHESCAPE));
}
if (uj)