xref: /third_party/json/docs/examples/operator_literal_json.cpp
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/json/docs/examples/
1c5f01b2fSopenharmony_ci#include <iostream>
2c5f01b2fSopenharmony_ci#include <iomanip>
3c5f01b2fSopenharmony_ci#include <nlohmann/json.hpp>
4c5f01b2fSopenharmony_ci
5c5f01b2fSopenharmony_ciusing json = nlohmann::json;
6c5f01b2fSopenharmony_ciusing namespace nlohmann::literals;
7c5f01b2fSopenharmony_ci
8c5f01b2fSopenharmony_ciint main()
9c5f01b2fSopenharmony_ci{
10c5f01b2fSopenharmony_ci    json j = R"( {"hello": "world", "answer": 42} )"_json;
11c5f01b2fSopenharmony_ci
12c5f01b2fSopenharmony_ci    std::cout << std::setw(2) << j << '\n';
13c5f01b2fSopenharmony_ci}
14

Indexes created Thu Nov 07 10:32:03 CST 2024