转自:http://buluzhai.iteye.com/blog/845404 首先感谢作者!!
先看json的数据结构
c中没有对象,所以json数据是采用链表存储的
C代码如下:
typedef struct cJSON {
struct cJSON *next,*prev; // 数组 对象数据中用到
struct cJSON *child; // 数组 和对象中指向子数组对象或值
int type; // 元素的类型,如是对象还是数组
char *valuestring; // 如果是字符串
int valueint; // 如果是数值
double valuedouble; // 如果类型是cJSON_Number
char *string; // The item's name string, if this item is the child of, or is in the list of subitems of an object.
} cJSON;
比如你有一个json数据如下:
1 {
2 "name": "Jack (\"Bee\") Nimble",
3 "format": {
4 "type": "rect",
5 "width": 1920,
6 "height": 1080,
7 "interlace": false,
8 "frame rate": 24
9 }
10 }
json进阶(一)js读取解析JSON类型数据
js读取解析JSON类型数据 一.什么是JSON? JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,采用完全独立于语言的文本格式,是理想的数据交换格式,同 ...
js读取解析JSON类型数据【申明:来源于网络】
js读取解析JSON类型数据[申明:来源于网络] 地址:http://blog.csdn.net/sunhuaqiang1/article/details/47026841
js读取解析JSON类型数据(转)
谢谢博主,转自http://blog.csdn.net/beyond0851/article/details/9285771 一.什么是JSON? JSON(JavaScript Object Not ...
js读取解析JSON类型数据