Parsing the form [ "1", "2", "3", "4"] of data json

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/hairubb/article/details/102778242

int cjson_parse(char *json_data)
{
    cJSON *json,*item;
    int i;
    json=cJSON_Parse(json_data);
    if (!json)
    {
        printf("Error before: [%s]\n",cJSON_GetErrorPtr());
        return -1;
    }
    else
    {
        int size=cJSON_GetArraySize(json);
        for(i=0;i<size;i++)
        {
            item=cJSON_GetArrayItem(json,i);

           // atoi (item-> valuestring) until integer,

        }

   }

}

Guess you like

Origin blog.csdn.net/hairubb/article/details/102778242