diff options
Diffstat (limited to '')
-rw-r--r-- | src/json.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -17,9 +17,9 @@ #include <stdlib.h> #include <string.h> -const char *json_to_string(struct json_object *obj) +static const char *json_to_string_internal(struct json_object *obj, int flags) { - const char *result = json_object_to_json_string(obj); + const char *result = json_object_to_json_string_ext(obj, flags); if (!result) { json_errno("json_object_to_json_string"); return NULL; @@ -27,6 +27,16 @@ const char *json_to_string(struct json_object *obj) return result; } +const char *json_to_string(struct json_object *obj) +{ + return json_to_string_internal(obj, JSON_C_TO_STRING_SPACED); +} + +const char *json_to_string_pretty(struct json_object *obj) +{ + return json_to_string_internal(obj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY); +} + struct json_object *json_from_string(const char *src) { enum json_tokener_error error; |