...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Parse a buffer containing a complete JSON text.
std::size_t write_some( string_view s);
This function parses a complete JSON text contained in the specified character buffer. Additional characters past the end of the complete JSON text are ignored. The function returns the actual number of characters parsed, which may be less than the size of the input. This allows parsing of a buffer containing multiple individual JSON texts or containing different protocol data:
parser p; // construct a parser size_t n = p.write_some( "[1,2,3] null" ); // parse a complete JSON text assert( n == 8 ); // only some characters consumed value jv = p.release(); // take ownership of the value
Linear in size
.
Basic guarantee. Calls to memory_resource::allocate
may throw. Upon error or exception, subsequent calls will fail until
reset
is called to parse a new JSON text.
The number of characters consumed from the buffer.
Name |
Description |
---|---|
|
The character string to parse. |
Type |
Thrown On |
---|---|
boost::system::system_error |
Thrown on error. |