typedefstructcJSON { structcJSON *next,*prev;/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ structcJSON *child;/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
int type; /* The type of the item, as above. */
char *valuestring; /* The item's string, if type==cJSON_String */ int valueint; /* The item's number, if type==cJSON_Number */ double valuedouble; /* The item's number, if type==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;
item->type=cJSON_Array; value=skip(value+1); if (*value==']') return value+1; /* empty array. */
item->child=child=cJSON_New_Item(); if (!item->child) return0; /* memory fail */ value=skip(parse_value(child,skip(value))); /* skip any spacing, get the value. */ if (!value) return0;
while (*value==',') { cJSON *new_item; if (!(new_item=cJSON_New_Item())) return0; /* memory fail */ child->next=new_item;new_item->prev=child;child=new_item; value=skip(parse_value(child,skip(value+1))); if (!value) return0; /* memory fail */ }
if (*value==']') return value+1; /* end of array */ ep=value;return0; /* malformed. */ }