int test(void)
{
char str[] = "{"Content-Name":"network_data_cgi","Content-Length":51,"Content-Detail":"op_code=get&if_index=0&ip=null&mask=null&gateway=null&mac=null&dns="}";
cJSON *json = cJSON_Parse(str);
if (json == NULL)
{
printf("json NULL\n");
return -1;
}
cJSON *ruleJson = cJSON_GetObjectItem(json, "test");
if (ruleJson ->type == cJSON_NULL) //判断类型
{
printf("type : cJSON_NULL\n");
}
}
cJSON解析value值为null时处理
于 2024-10-30 17:29:24 首次发布