]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/examples/accept__string.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / examples / accept__string.cpp
1 #include <iostream>
2 #include <iomanip>
3 #include <nlohmann/json.hpp>
4
5 using json = nlohmann::json;
6
7 int main()
8 {
9 // a valid JSON text
10 auto valid_text = R"(
11 {
12 "numbers": [1, 2, 3]
13 }
14 )";
15
16 // an invalid JSON text
17 auto invalid_text = R"(
18 {
19 "strings": ["extra", "comma", ]
20 }
21 )";
22
23 std::cout << std::boolalpha
24 << json::accept(valid_text) << ' '
25 << json::accept(invalid_text) << '\n';
26 }