http://www.cnblogs.com/wing-h/p/3263488.html参考
const char *curl_easy_strerror(CURLcode errornum);
JSONCPP常用于CURL收发数据的格式
JSon::Reader reader.getFormatedErrorMessages()
JSONCPP解析数组
- void json_parse_test()
- {
-
- const char* str = "{\"beat\":\"alive\",\"connList\":[{\"agentServerIp\":\"1\",\"ticket\":\"49cd0681-afe3-11e3-9fef-22e4084033f2\",\"agentServerPort\":\"8080\"}]}";
- //const char* str = "{\"beat\":\"alive\",\"connList\":[]}";
- Json::Reader r;
- Json::Value aroot;
- if ( r.parse(str, aroot) ) {
- if ( aroot["connList"].empty()) {
- printf(" is empty\n");
-
- } else {
- printf(" is not empty\n");
- Json::Value items = aroot["connList"];
- int item_size = items.size();
- int i;
- for ( i = 0; i < item_size; i++ )
- {
- printf("%s\n", items[i]["ticket"].asString().c_str());
- }
-
- }
- } else {
- puts(r.getFormatedErrorMessages().c_str());
- }
- }