JSON的C语言实现: JSON-C – A JSON implementation in C

 JSON-C能让你在C语言里轻松创建JSON对象,输出JSON字符串,解析JSON字符串成JSON对象。
test1.c的部分实例代码:

  1. struct json_object *my_array;
  2.   my_array = json_object_new_array();
  3.   json_object_array_add(my_array, json_object_new_int(1));
  4.   json_object_array_add(my_array, json_object_new_int(2));
  5.   json_object_array_add(my_array, json_object_new_int(3));
  6.   json_object_array_put_idx(my_array, 4, json_object_new_int(5));
  7.   printf("my_array=\n");
  8.   for(i=0; i < json_object_array_length(my_array); i++) {
  9.     struct json_object *obj = json_object_array_get_idx(my_array, i);
  10.     printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
  11.   }
  12.   printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

地址: http://oss.metaparadigm.com/json-c/

[Original] JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects.

Copyright Metaparadigm Pte. Ltd. 2004, 2005. Michael Clark 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值