在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:json-parser/json-builder开源软件地址:https://github.com/json-parser/json-builder开源编程语言:C 98.7%开源软件介绍:The serializing counterpart to json-parser. As with json-parser: BSD licensed, almost ANSI C89 apart from a single use of snprintf. UsageQuick example (docs coming soon): json_value * arr = json_array_new(0);
json_array_push(arr, json_string_new("Hello world!"));
json_array_push(arr, json_integer_new(128));
char * buf = malloc(json_measure(arr));
json_serialize(buf, arr);
printf("%s\n", buf); [ "Hello world!", 128 ] json-builder is fully interoperable with json-parser: char json[] = "[ 1, 2, 3 ]";
json_settings settings = {};
settings.value_extra = json_builder_extra; /* space for json-builder state */
char error[128];
json_value * arr = json_parse_ex(&settings, json, strlen(json), error);
/* Now serialize it again. */
char * buf = malloc(json_measure(arr));
json_serialize(buf, arr);
printf("%s\n", buf); [ 1, 2, 3 ] Note that values created by or modified by json-builder must be freed with
Modes
[
1,
2,
3
]
[ 1, 2, 3 ]
[1,2,3] Options
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论