[英]How can I get the array length in nlohmann's json library?
I am using nlohmann/json lib and want to get the length of a json array.我正在使用 nlohmann/json lib 并想获取 json 数组的长度。 Image i have:
图片我有:
[
"test",
"test2"
]
and want to recieve the length (2).并希望收到长度 (2)。 When i tried the .length() method, it showed me this error:
当我尝试 .length() 方法时,它显示了这个错误:
using json = using json = class nlohmann::basic_json<>' {aka 'class nlohmann::basic_json<>'} has no member named 'length
using json = using json = class nlohmann::basic_json<>' {aka 'class nlohmann::basic_json<>'} 没有名为 'length 的成员
so how can I get the length in this library?那么我怎样才能得到这个库中的长度呢?
您想在这里使用myJsonArray.size()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.