diff --git a/test.c b/test.c index a9f6697..ccb82b1 100644 --- a/test.c +++ b/test.c @@ -78,6 +78,8 @@ void create_objects() root=cJSON_CreateArray(); for (i=0;i<3;i++) cJSON_AddItemToArray(root,cJSON_CreateIntArray(numbers[i],3)); + cJSON_ReplaceItemInArray(root,1,cJSON_CreateString("Replacement")); + out=cJSON_Print(root); cJSON_Delete(root); printf("%s\n",out); free(out); @@ -115,6 +117,8 @@ void create_objects() cJSON_AddStringToObject(fld, "Country", fields[i].country); } + cJSON_ReplaceItemInObject(cJSON_GetArrayItem(root,1),"City",cJSON_CreateIntArray(ids,4)); + out=cJSON_Print(root); cJSON_Delete(root); printf("%s\n",out); free(out); }