C语言中进行 JSON 的创建和解析

来源:互联网 发布:北京海洋馆客流量数据 编辑:程序博客网 时间:2024/06/01 08:37

json-c:

官方API地址:

http://json-c.github.io/json-c/json-c-0.12/doc/html/json__object_8h.html#a9d14fd03ed7520c4aa33ab53b4569414

struct json_object * json_object_get (struct json_object *obj) int json_object_put (struct json_object *obj) int json_object_is_type (struct json_object *obj, enum json_type type) enum json_type json_object_get_type (struct json_object *obj) const char * json_object_to_json_string (struct json_object *obj) const char * json_object_to_json_string_ext (struct json_object *obj, int flags) void json_object_set_serializer (json_object *jso, json_object_to_json_string_fn to_string_func, void *userdata, json_object_delete_fn *user_delete) struct json_object * json_object_new_object (void) struct lh_table * json_object_get_object (struct json_object *obj) int json_object_object_length (struct json_object *obj) void json_object_object_add (struct json_object *obj, const char *key, struct json_object *val)  THIS_FUNCTION_IS_DEPRECATED (extern struct json_object *json_object_object_get(struct json_object *obj, const char *key)) json_bool json_object_object_get_ex (struct json_object *obj, const char *key, struct json_object **value) void json_object_object_del (struct json_object *obj, const char *key) struct json_object * json_object_new_array (void) struct array_list * json_object_get_array (struct json_object *obj) int json_object_array_length (struct json_object *obj) void json_object_array_sort (struct json_object *jso, int(*sort_fn)(const void *, const void *)) int json_object_array_add (struct json_object *obj, struct json_object *val) int json_object_array_put_idx (struct json_object *obj, int idx, struct json_object *val) struct json_object * json_object_array_get_idx (struct json_object *obj, int idx) struct json_object * json_object_new_boolean (json_bool b) json_bool json_object_get_boolean (struct json_object *obj) struct json_object * json_object_new_int (int32_t i) struct json_object * json_object_new_int64 (int64_t i) int32_t json_object_get_int (struct json_object *obj) int64_t json_object_get_int64 (struct json_object *obj) struct json_object * json_object_new_double (double d) struct json_object * json_object_new_double_s (double d, const char *ds) double json_object_get_double (struct json_object *obj) struct json_object * json_object_new_string (const char *s) struct json_object * json_object_new_string_len (const char *s, int len) const char * json_object_get_string (struct json_object *obj) int json_object_get_string_len (struct json_object *obj)

http://json-c.github.io/json-c/json-c-0.12/doc/html/json__tokener_8h.html#a0d9a666c21879647e8831f9cfa691673

const char * json_tokener_error_desc (enum json_tokener_error jerr) enum json_tokener_error json_tokener_get_error (struct json_tokener *tok) struct json_tokener * json_tokener_new (void) struct json_tokener * json_tokener_new_ex (int depth) void json_tokener_free (struct json_tokener *tok) void json_tokener_reset (struct json_tokener *tok) struct json_object * json_tokener_parse (const char *str) struct json_object * json_tokener_parse_verbose (const char *str, enum json_tokener_error *error) void json_tokener_set_flags (struct json_tokener *tok, int flags) struct json_object * json_tokener_parse_ex (struct json_tokener *tok, const char *str, int len)

官方文档:

https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/


转载示例:

http://xmgu2008.blog.163.com/blog/static/139122380201411791755220/


cjson:

转载示例:

http://www.cnblogs.com/fengbohello/p/4033272.html


0 0
原创粉丝点击