The following code produces unexpected output (which is, all four statements being printed):
#include <iostream>
#include "json.hpp"
int main()
{
nlohmann::json j;
if (j.empty()) {
std::cout << "Object is empty" << std::endl;
}
if (j.is_null()) {
std::cout << "Object is null" << std::endl;
}
nlohmann::json k;
j["aminull"] = k;
if (j["aminull"].empty()) {
std::cout << "Object under key is empty" << std::endl;
}
if (j["aminull"].is_null()) {
std::cout << "Object under key is null" << std::endl;
}
return 0;
}
I am not entirely sure whether or not this is the expected behaviour, but I think it would be more intuitive to have only the empty() conditions evaluate to true and the others to false?
Best wishes and thanks for the great work!
The following code produces unexpected output (which is, all four statements being printed):
I am not entirely sure whether or not this is the expected behaviour, but I think it would be more intuitive to have only the empty() conditions evaluate to true and the others to false?
Best wishes and thanks for the great work!