...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 JSON text into a user-defined object.
Defined in header <boost/json/parse_into.hpp>
template< class V> void parse_into( V& v,std::istream
& is,parse_options
const& opt = {});
This function reads data from an input stream and fills an object provided
by the user. If the buffer does not contain a complete serialized JSON
text, or contains extra non-whitespace data, an exception is thrown. In
this case v
may be partially
filled.
The function supports default constructible types satisfying SequenceContainer,
arrays, arithmetic types, bool
,
std::tuple
, std::pair
,
std::optional
, std::nullptr_t
,
and structs and enums described using Boost.Describe.
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
.
Name |
Description |
---|---|
|
The type to parse into. |
|
The stream to read from. |
|
The options for the parser. If this parameter is omitted, the parser will accept only standard JSON. |
Type |
Thrown On |
---|---|
boost::system::system_error |
on failed parse. |
Convenience header <boost/json.hpp>