获取的json数据
{
"A": [
{
"B": [
{
"C": [
"text"
],
"D": 1,
"E": 0,
"F": "text"
}
],
"G": "text"
}
]
}
反序列化解析成json::value
Json::Value root;
JSONCPP_STRING errs;
Json::CharReaderBuilder jsreader;
std::unique_ptr<Json::CharReader> const reader(jsreader.newCharReader());
bool parse_ok = reader->parse(chunk, LPCSTR(chunk) + chunk.GetLength(), &root, &errs);
if (!parse_ok)
{
cout << "反序列化失败" << endl;
return 1;
}
else
{
//获取到C的值
root["A"][0]["B