cJSON 作为 Json 格式的解析库,其主要功能就是构建和解析 Json 格式
CJSON解析json字符串 {"action":"started","code":"0","data":"","desc":"success","sid":"a8"}
#include <stdio.h>  
#include <stdlib.h>  
#include "cJSON.h"  int main() {  char *json_string = "{\"action\":\"started\",\"code\":\"0\",\"data\":\"\",\"desc\":\"success\",\"sid\":\"a8\"}";  // 解析JSON字符串  cJSON *root = cJSON_Parse(json_string);  if (root == NULL) {  printf("Error before: [%s]\n", cJSON_GetErrorPtr());  return 1;  }  // 获取各个字段的值  cJSON *action = cJSON_GetObjectItem(root, "action");  cJSON *code = cJSON_GetObjectItem(root, "code");  cJ