cJSON *cJSON_GetObjectItem(cJSON *object, const char *string) { cJSON *c = object->child; while(c && cJSON_strcasecmp(c->string, string)) c = c->next; return c; }
cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) { int i=0; cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next; if (c) return cJSON_DetachItemFromArray(object,i); return 0; }
void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem) { int i=0; cJSON *c=object->child; while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next; if(c) { newitem->string=cJSON_strdup(string); cJSON_ReplaceItemInArray(object,i,newitem); } }
cJSON *ICACHE_FLASH_ATTR 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; }
cJSON *cJSON_GetObjectItemV2(cJSON *object,const char *string,int*pos=NULL){ int hash_code=BKDRHash(string),i=0; cJSON *c=object->child; while (c){ if(c->hash_string==-1){c->hash_string=BKDRHash(c->string);} if(c->hash_string==hash_code && !cJSON_strcasecmp(c->string,string)){if(pos)*pos=i;return c;} c=c->next; i++; } return c; }
cJSON *ICACHE_FLASH_ATTR cJSON_DetachItemFromObject(cJSON *object, const char *string) { int i = 0; cJSON *c = object->child; while (c && cJSON_strcasecmp(c->string, string)) { i++, c = c->next; } if (c) { return cJSON_DetachItemFromArray(object, i); } return 0; }
cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) { int i = 0; cJSON *c = object->child; while (c && cJSON_strcasecmp(c->string,string)) { i++; c = c->next; } if (c) { return cJSON_DetachItemFromArray(object, i); } return NULL; }
void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { int i = 0; cJSON *c = object->child; while(c && cJSON_strcasecmp(c->string, string)) { i++; c = c->next; } if(c) { /* free the old string if not const */ if (!(newitem->type & cJSON_StringIsConst) && newitem->string) { cJSON_free(newitem->string); } newitem->string = cJSON_strdup(string); cJSON_ReplaceItemInArray(object, i, newitem); } }
char *cJSON_GetObjectItemString(cJSON *object,const char *string){cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; if(!c) return NULL; return c->valuestring;}