|
@@ -661,6 +661,17 @@ static char *print_object(cJSON *item,int depth,int fmt,printbuffer *p)
|
|
|
int cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;}
|
|
|
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;}
|
|
|
cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
|
|
|
+int *cJSON_HasObjectItem(cJSON *object,const char *string) {
|
|
|
+ cJSON *c=object->child;
|
|
|
+ while (c )
|
|
|
+ {
|
|
|
+ if(cJSON_strcasecmp(c->string,string)==0){
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ c=c->next;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
/* Utility for array list handling. */
|
|
|
static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;}
|