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

Function max_nesting_path_example

examples/src/json_parse_examples.cpp:99–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void max_nesting_path_example()
100{
101 std::string s = "[[[[[[[[[[[[[[[[[[[[[\"Too deep\"]]]]]]]]]]]]]]]]]]]]]";
102 try
103 {
104 auto options = json_options{}
105 .max_nesting_depth(20);
106 json::parse(s, options);
107 }
108 catch (const ser_error& e)
109 {
110 std::cout << e.what() << '\n';
111 }
112}
113
114#if defined(JSONCONS_HAS_POLYMORPHIC_ALLOCATOR) && JSONCONS_HAS_POLYMORPHIC_ALLOCATOR == 1
115#include <memory_resource>

Callers 1

mainFunction · 0.85

Calls 3

parseFunction · 0.85
max_nesting_depthMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected