...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Return parsed JSON as a value
.
Defined in header <boost/json/parse.hpp>
value
parse(std::istream
& is,boost::system::error_code
& ec,storage_ptr
sp = {},parse_options
const& opt = {});
This function reads data from an input stream and parses it to produce
a complete JSON entity, returned as a value
. If the stream does not
contain a complete serialized JSON, or contains extra non-whitespace data,
an error occurs. In this case the returned value will be null
, using the default
memory resource.
Linear in the size of consumed input.
Basic guarantee. Calls to memory_resource::allocate
may throw. The stream may throw as described by std::ios::exceptions
.
A value representing the parsed JSON, or a null
if any error occurred.
Name |
Description |
---|---|
|
The stream to read from. |
|
Set to the error, if any occurred. |
|
The memory resource that the new value and all of its elements will use. If this parameter is omitted, the default memory resource is used. |
|
The options for the parser. If this parameter is omitted, the parser will accept only standard JSON. |
parse_options
,
stream_parser
,
value::operator>>
.
Convenience header <boost/json.hpp>