int test(void)
{
char str[] = "{\"test\":null}";
printf("str:%s\n", str);
cJSON *json = cJSON_Parse(str);
if (json == NULL)
{
printf("json NULL\n");
return -1;
}
cJSON *test = cJSON_GetObjectItem(json, "test");
if (test->type == cJSON_NULL) //判断类型
{
printf("type : cJSON_NULL\n");
}
// printf("%d\n", test->valueint); //打印 0
// printf("%s\n", test->valuestring); //段错误
// printf("%ld\n", strlen(test->valuestring)); //段错误
}