nlohmann json:通过for遍历object和array_风静如云的博客-CSDN博客
介绍了通过for基于元素迭代的方式进行遍历。
还可以通过begin/end迭代器对object/array进行遍历:
#include <iostream>
#include <nlohmann/json.hpp>
using namespace std;
using json = nlohmann::json;auto checkJsonType(json& x)
{if(x.type() == json::value_t::null){cout<<x<<" is null"<<endl;}else if(x.type() == json::value_t::object){cout<<x<<" is object"<<endl;}else if(x.type() == json::value_t::array){cout<<x<<" is array"<<endl;}else if(x.type() == json::value_t::string){cout<<x<<"