This commit is contained in:
nlohmann
2026-10-26 21:24:35 +00:00
parent 41c601a7d1
commit d2e264bd84
1400 changed files with 11859 additions and 5440 deletions
+5 -1
View File
@@ -20,7 +20,7 @@ Add the single header to your project and use the library like this:
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using nlohmann::json;
int main()
{
@@ -31,6 +31,10 @@ int main()
j["name"] = "Niels";
j["list"] = {1, 0, 2};
// read a value into a C++ variable and use it
double pi = j["pi"].get<double>();
std::cout << "2 * pi = " << 2 * pi << '\n';
// serialize with an indent of 4 spaces
std::cout << j.dump(4) << '\n';
}