cJSON解析null类型
cJSON
Ultralightweight JSON parser in ANSI C
项目地址:https://gitcode.com/gh_mirrors/cj/cJSON

·
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)); //段错误
}




Ultralightweight JSON parser in ANSI C
最近提交(Master分支:20 天前 )
c859b25d
18 天前
74e1ff49
this fixes CVE-2025-57052 23 天前
更多推荐
所有评论(0)