cJSON插入项
cJSON
Ultralightweight JSON parser in ANSI C
项目地址:https://gitcode.com/gh_mirrors/cj/cJSON
免费下载资源
·
函数:
cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem);
参数:
array 插入的json项
which 插入第几项
newitem 插入项
代码示例:
/* 创建object对象 */
cJSON *pstJsonObject;
pstJsonObject = cJSON_CreateObject();
/* 创建键值 以及数字 */
cJSON *pstJsonItem;
pstJsonItem = cJSON_CreateNumber();
/* 错误设置key 方法
pstJsonItem->string = "key";
*/
char key[] = "key";
memcpy(pstJsonItem->string, key, sizeof(key);
/* 插入位置1 插入对象pstJsonObject 插入项pstJsonItem*/
cJSON_InsertItemInArray(pstJsonObject, 1, pstJsonItem);
GitHub 加速计划 / cj / cJSON
10.44 K
3.16 K
下载
Ultralightweight JSON parser in ANSI C
最近提交(Master分支:1 个月前 )
424ce4ce
This reverts commit 5b502cdbfb21fbe5f6cf9ffbd2b96e4281a741e6.
Related to #860
2 个月前
32497300 - 4 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)