1 intcreate_objects()2 {3 cJSON *root, *fmt, *img, *thm, *fld;4 char *out;5 int i; /*The index number.*/
6 int ret = 0;7
8 /*Here we construct several JSON objects.*/
9
10 //------------------构建第1个----------------------
11 /*The "Video" data type:*/
12 root =cJSON_CreateObject();13 cJSON_AddItemToObject(root, "name", cJSON_CreateString("Jack (\"Bee\") Nimble"));14 cJSON_AddItemToObject(root, "format", fmt =cJSON_CreateObject());15 cJSON_AddStringToObject(fmt, "type", "rect");16 cJSON_AddNumberToObject(fmt, "width", 1920);17 cJSON_AddNumberToObject(fmt, "height", 1080);18 cJSON_AddFalseToObject (fmt, "interlace");19 cJSON_AddNumberToObject(fmt, "frame rate", 24);20
21 out = cJSON_Print(root); /*Print to text*/
22 cJSON_Delete(root); /*Delete the cJSON object*/
23 LOG_I(c