This commit fixes a bug where json output would display
',,,,,,,' because we were deciding to not display information
about some routes due to a selection criteria.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
continue;
display = 0;
- if (!first && use_json)
- vty_out(vty, ",");
if (use_json)
json_paths = json_object_new_array();
else
inet_ntop(p->family, &p->u.prefix,
buf, BUFSIZ),
p->prefixlen);
- vty_out(vty, "\"%s\": ", buf2);
+ if (first)
+ vty_out(vty, "\"%s\": ", buf2);
+ else
+ vty_out(vty, ",\"%s\": ", buf2);
+
vty_out(vty, "%s",
json_object_to_json_string_ext(json_paths, JSON_C_TO_STRING_PRETTY));
json_object_free(json_paths);