Add a json_set_serializer() function to allow the string output of a json_object to be customized.

This commit is contained in:
Eric Haszlakiewicz
2012-09-02 15:21:56 -05:00
parent f74e8f8f9b
commit 38f421a2e7
8 changed files with 214 additions and 10 deletions

View File

@@ -16,16 +16,12 @@
extern "C" {
#endif
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,
int level,
int flags);
typedef void (json_object_private_delete_fn)(struct json_object *o);
struct json_object
{
enum json_type o_type;
json_object_delete_fn *_delete;
json_object_private_delete_fn *_delete;
json_object_to_json_string_fn *_to_json_string;
int _ref_count;
struct printbuf *_pb;
@@ -40,6 +36,8 @@ struct json_object
int len;
} c_string;
} o;
json_object_delete_fn *_user_delete;
void *_userdata;
};
#ifdef __cplusplus