two bizarre tweaks to demonstrate the replace functionality.

git-svn-id: http://svn.code.sf.net/p/cjson/code@15 e3330c51-1366-4df0-8b21-3ccf24e3d50e
This commit is contained in:
Dave Gamble 2009-11-10 23:51:15 +00:00
parent 991b577247
commit 6b51f927e9
1 changed files with 4 additions and 0 deletions

4
test.c
View File

@ -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);
}