Files
json/examples/format_as.cpp
T
2026-10-26 21:24:35 +00:00

17 lines
335 B
C++

#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
int main()
{
// create a JSON value
json j = {{"one", 1}, {"two", 2}};
// format_as() is found via argument-dependent lookup, the same way
// fmt::format/fmt::print would find it
auto j_str = format_as(j);
std::cout << j_str << '\n';
}