代码:
#include <stdio.h>
#include <cJSON.h>
int main()
{
const char* json_str = "{\"A\":22,\"B\":\"1111111111\",\"C\":12345}";
cJSON* item = cJSON_Parse(json_str);
cJSON *node = NULL;
node = item->child;
while (node != NULL)
{
printf("%s\n",node->string);
node = node->next;
}
return 0;
}
运行结果如下:
A
B
C