![](/img/trans.png)
[英]Why can't I use the [] operator to access an array in nlohmann's C++ JSON library?
[英]How can I get the array length in nlohmann's json library?
我正在使用 nlohmann/json lib 并想获取 json 数组的长度。 图片我有:
[
"test",
"test2"
]
并希望收到长度 (2)。 当我尝试 .length() 方法时,它显示了这个错误:
using json = using json = class nlohmann::basic_json<>' {aka 'class nlohmann::basic_json<>'} 没有名为 'length 的成员
那么我怎样才能得到这个库中的长度呢?
您想在这里使用myJsonArray.size()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.