Lines Matching defs:json
4 // |_____|_____|_____|_|___| https://github.com/nlohmann/json
13 #include <nlohmann/json.hpp>
14 using nlohmann::json;
23 json metadata = nullptr;
32 person_with_private_data(std::string name_, int age_, json metadata_)
46 json metadata = nullptr;
55 person_with_private_data_2(std::string name_, int age_, json metadata_)
69 json getMetadata() const
82 json metadata = nullptr;
90 person_without_private_data_1(std::string name_, int age_, json metadata_)
104 json metadata = nullptr;
112 person_without_private_data_2(std::string name_, int age_, json metadata_)
126 json metadata = nullptr;
134 person_without_private_data_3(std::string name_, int age_, json metadata_)
148 json getMetadata() const
293 CHECK(json(p1).dump() == "{\"age\":1,\"metadata\":{\"haircuts\":2},\"name\":\"Erik\"}");
296 auto p2 = json(p1).get<T>();
300 CHECK(T(json(p1)) == p1);
301 CHECK(json(T(json(p1))) == json(p1));
304 json j = json(p1);
306 CHECK_THROWS_WITH_AS(j.get<T>(), "[json.exception.out_of_range.403] key 'age' not found", json::out_of_range);
318 CHECK(json(p0).dump() == "{\"age\":0,\"metadata\":null,\"name\":\"\"}");
322 CHECK(json(p1).dump() == "{\"age\":1,\"metadata\":{\"haircuts\":2},\"name\":\"Erik\"}");
325 auto p2 = json(p1).get<T>();
329 CHECK(T(json(p1)) == p1);
330 CHECK(json(T(json(p1))) == json(p1));
333 json j = json(p1);
352 nlohmann::json j = obj1; //via json object
361 nlohmann::json j1 = obj1; //via json string
363 nlohmann::json j2 = nlohmann::json::parse(s);
372 nlohmann::json j1 = obj1; //via msgpack
373 std::vector<uint8_t> buf = nlohmann::json::to_msgpack(j1);
374 nlohmann::json j2 = nlohmann::json::from_msgpack(buf);
383 nlohmann::json j1 = obj1; //via bson
384 std::vector<uint8_t> buf = nlohmann::json::to_bson(j1);
385 nlohmann::json j2 = nlohmann::json::from_bson(buf);
394 nlohmann::json j1 = obj1; //via cbor
395 std::vector<uint8_t> buf = nlohmann::json::to_cbor(j1);
396 nlohmann::json j2 = nlohmann::json::from_cbor(buf);
405 nlohmann::json j1 = obj1; //via ubjson
406 std::vector<uint8_t> buf = nlohmann::json::to_ubjson(j1);
407 nlohmann::json j2 = nlohmann::json::from_ubjson(buf);