object和array可以使用数for进行遍历:
#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<<" is string"<<endl;
}
else if(x.type() == json::value_t::boolean)
{
cout<<x<<" is boolean"<<endl;
}
else if(x.type() == json::value_t::number_integer)
{
cout<<x<<" is number_integer"<<en