Add a json_object_to_json_string_ext() function to allow the formatting of output to be selected.

There are now three options: JSON_C_TO_STRING_SPACED, JSON_C_TO_STRING_PLAIN and JSON_C_TO_STRING_PRETTY.
This also add a json_object_to_file_ext() that takes the same flags.
Existing output of json_object_to_json_string() is unchanged, and uses JSON_C_TO_STRING_SPACED.
Thanks fo Grant Edwards for the initial patches.
This commit is contained in:
Eric Haszlakiewicz
2012-04-28 13:26:09 -05:00
parent f931f61851
commit 3fcffe1bb0
5 changed files with 167 additions and 47 deletions

View File

@@ -18,7 +18,9 @@ extern "C" {
typedef void (json_object_delete_fn)(struct json_object *o);
typedef int (json_object_to_json_string_fn)(struct json_object *o,
struct printbuf *pb);
struct printbuf *pb,
int level,
int flags);
struct json_object
{