Files
P4-USB-transfer/main/JSON/json.c
T

36 lines
836 B
C
Raw Normal View History

2026-10-13 21:54:50 +08:00
#include "cJSON.h"
#include "json.h"
// KEY_VALUE_PAIR data_pair =
// {
// .key = "action",
// .value = NULL,
// .son1_pair =
// }
void json_create(const char *str)
{
cJSON *report_msg = cJSON_CreateObject();
cJSON_AddStringToObject(report_msg, "action", "message");
cJSON_AddStringToObject(report_msg, "target_id", "0");
cJSON *data = cJSON_CreateObject();
cJSON_AddStringToObject(data, "status", "download_finish_ok");
cJSON_AddItemToObject(report_msg, "data", data);
char *report_str = cJSON_PrintUnformatted(report_msg);
}
cJSON* json_create_any_type(int type,cJSON *root, const char *key, const char *value)
{
cJSON *root = cJSON_CreateObject();
switch(type)
{
case 1://string
}
}