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

Function read_json_lines

examples/src/json_reader_examples.cpp:103–126  ·  view source on GitHub ↗

https://jsonlines.org/

Source from the content-addressed store, hash-verified

101
102// https://jsonlines.org/
103void read_json_lines()
104{
105 std::string data = R"(
106["Name", "Session", "Score", "Completed"]
107["Gilbert", "2013", 24, true]
108["Alexa", "2013", 29, true]
109["May", "2012B", 14, false]
110["Deloise", "2012A", 19, true]
111 )";
112
113 std::stringstream is(data);
114 json_decoder<json> decoder;
115 json_stream_reader reader(is, decoder);
116
117 while (!reader.eof())
118 {
119 reader.read_next();
120 if (!reader.eof())
121 {
122 json j = decoder.get_result();
123 std::cout << j << '\n';
124 }
125 }
126}
127
128void read_with_stateful_allocator()
129{

Callers 1

mainFunction · 0.85

Calls 3

get_resultMethod · 0.80
eofMethod · 0.45
read_nextMethod · 0.45

Tested by

no test coverage detected