This commit is contained in:
nlohmann
2025-01-26 17:41:56 +00:00
parent b0759e09b1
commit de895b1d1a
242 changed files with 530 additions and 476 deletions

View File

@@ -0,0 +1,14 @@
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
json j = json::parse(R"({"uint64": 18446744073709551615})");
std::cout << "operator[]: " << j["uint64"] << '\n'
<< "default value (int): " << j.value("uint64", 0) << '\n'
<< "default value (uint64_t): " << j.value("uint64", std::uint64_t(0)) << '\n'
<< "explict return value type: " << j.value<std::uint64_t>("uint64", 0) << '\n';
}

View File

@@ -0,0 +1,4 @@
operator[]: 18446744073709551615
default value (int): -1
default value (uint64_t): 18446744073709551615
explict return value type: 18446744073709551615