![]() |
Home | Libraries | People | FAQ | More |
Parse a buffer containing a complete JSON.
std::size_t write( string_view s);
This function parses a complete JSON contained in the specified character buffer. The entire buffer must be consumed; if there are additional characters past the end of the complete JSON, the parse fails and an error is returned.
parser p; // construct a parser size_t n = p.write( "\[1,2,3\]" ); // parse a complete JSON assert( n == 7 ); // all 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.
The number of characters consumed from the buffer.
Name |
Description |
---|---|
|
The character string to parse. |
Type |
Thrown On |
---|---|
|
Thrown on error. |