问题描述
大家好我从Web服务器接收JSON数组,想知道是否有一种方法使用rapidjson按顺序访问字段值,示例代码中的字段id始终存在但是title 根据内容可能会有所不同
for (SizeType i = 0 ; i< result_loop.Size(); i ++)
{
cout<< result_loop [i] [ id]。GetInt()<< - << result_loop [i] [ title]。GetString()<< \ n;
}
对不起泡沫
我尝试过:
for(SizeType i = 0; i< result_loop.Size(); i ++)
{
std :: cout<< result_loop [i] [id]。GetInt()<< - << result_loop [i] [title]。GetString()<< \ n;
}
Hi all I'm receiving a JSON array from a Web server and would like to know if there is a way using rapidjson to access field values by ordinal, the field "id" in the example code is always present but "title" can be different depending on the content
for (SizeType i = 0; i < result_loop.Size(); i++) { cout << result_loop[i]["id"].GetInt() << " - " << result_loop[i]["title"].GetString() << "\n"; }
sorry about the fomatting
What I have tried:
for (SizeType i = 0; i < result_loop.Size(); i++)
{
std::cout << result_loop[i]["id"].GetInt() << " - " << result_loop[i]["title"].GetString() << "\n";
}
这篇关于Rapidjson需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!