Lines Matching full:json
2 // __| | __| | | | JSON for Modern C++ (supporting code)
4 // |_____|_____|_____|_|___| https://github.com/nlohmann/json
11 #include <nlohmann/json.hpp>
12 using nlohmann::json;
40 json j;
63 // instead, you could also write (which looks very similar to the JSON above)
64 json j2 =
87 json empty_array_implicit = {{}};
89 json empty_array_explicit = json::array();
93 json empty_object_explicit = json::object();
97 json array_not_object = json::array({ {"currency", "USD"}, {"value", 42.99} });
106 json j = "{ \"happy\": true, \"pi\": 3.141 }"_json; // NOLINT(modernize-raw-string-literal)
115 auto j3 = json::parse(R"({"happy": true, "pi": 3.141})");
133 json j;
143 for (json::iterator it = j.begin(); it != j.end(); ++it) // NOLINT(modernize-loop-convert)
163 CHECK(j.type() == json::value_t::array); // json::value_t::array
167 json o;
182 json j_vec(c_vector);
186 json j_deque(c_deque);
190 json j_list(c_list);
194 json j_flist(c_flist);
198 json j_array(c_array);
202 json j_set(c_set); // only one entry for "one" is used
206 json j_uset(c_uset); // only one entry for "one" is used
210 json j_mset(c_mset); // both entries for "one" are used
214 json j_umset(c_umset); // both entries for "one" are used
220 json j_map(c_map);
224 json j_umap(c_umap);
228 json j_mmap(c_mmap); // only one entry for key "three" is used
232 json j_ummap(c_ummap); // only one entry for key "three" is used
239 json js = s1;
244 json jb = b1;
250 json jn = i;
266 // a JSON value
267 json j_original = R"({
272 // access members with a JSON pointer (RFC 6901)
276 // a JSON patch (RFC 6902)
277 json j_patch = R"([
284 json j_result = j_original.patch(j_patch);
290 // calculate a JSON patch from two JSON values
291 auto res = json::diff(j_result, j_original);