summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 76d907408c..2a0bb9446a 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -284,7 +284,8 @@ done:
return len;
}
-int vty_json(struct vty *vty, struct json_object *json)
+static int vty_json_helper(struct vty *vty, struct json_object *json,
+ uint32_t options)
{
const char *text;
@@ -299,6 +300,18 @@ int vty_json(struct vty *vty, struct json_object *json)
return CMD_SUCCESS;
}
+int vty_json(struct vty *vty, struct json_object *json)
+{
+ return vty_json_helper(vty, json,
+ JSON_C_TO_STRING_PRETTY |
+ JSON_C_TO_STRING_NOSLASHESCAPE);
+}
+
+int vty_json_no_pretty(struct vty *vty, struct json_object *json)
+{
+ return vty_json_helper(vty, json, JSON_C_TO_STRING_NOSLASHESCAPE);
+}
+
/* Output current time to the vty. */
void vty_time_print(struct vty *vty, int cr)
{