简体   繁体   中英

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. Image i have:

[
"test",
"test2"
]

and want to recieve the length (2). When i tried the .length() method, it showed me this error:

using json = using json = class nlohmann::basic_json<>' {aka 'class nlohmann::basic_json<>'} has no member named 'length

so how can I get the length in this library?

您想在这里使用myJsonArray.size()方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM