MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / flatten_and_unflatten

Function flatten_and_unflatten

examples/src/jsonpath_examples.cpp:532–560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530}
531
532void flatten_and_unflatten()
533{
534 auto input = jsoncons::json::parse(R"(
535 {
536 "application": "hiking",
537 "reputons": [
538 {
539 "rater": "HikingAsylum",
540 "assertion": "advanced",
541 "rated": "Marilyn C",
542 "rating": 0.90
543 },
544 {
545 "rater": "HikingAsylum",
546 "assertion": "intermediate",
547 "rated": "Hongmin",
548 "rating": 0.75
549 }
550 ]
551 }
552 )");
553
554 jsoncons::json result = jsonpath::flatten(input);
555
556 std::cout << pretty_print(result) << "\n";
557
558 jsoncons::json original = jsonpath::unflatten(result);
559 assert(original == input);
560}
561
562void more_json_query_examples()
563{

Callers 1

mainFunction · 0.70

Calls 4

parseFunction · 0.85
pretty_printFunction · 0.85
flattenFunction · 0.50
unflattenFunction · 0.50

Tested by

no test coverage detected