代码简单实例:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include "../cjson/cJSON.h"
int main()
{
/*Cjson数据包的创建*/
// 创建JSON Object
cJSON *root = cJSON_CreateObject();
cJSON *info = cJSON_CreateObject();
// 加入节点(键值对),节点名称为action,值为666
cJSON_AddNumberToObject(root,"action",666);
/*在root json数据包中增加一个子项目info。相当于结构体中嵌套子