Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 1cc2d37fc6.
PrevUpHomeNext
parse_into (5 of 6 overloads)

Parse a JSON text into a user-defined object.

Synopsis

Defined in header <boost/json/parse_into.hpp>

template<
    class V>
void
parse_into(
    V& v,
    string_view sv,
    parse_options const& opt = {});
Description

This function parses an entire string in one step and fills an object provided by the user. If the buffer does not contain a complete serialized JSON text, 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.

Complexity

Linear in sv.size().

Exception Safety

Basic guarantee. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

v

The type to parse into.

sv

The string to parse.

opt

The options for the parser. If this parameter is omitted, the parser will accept only standard JSON.

Exceptions

Type

Thrown On

boost::system::system_error

on failed parse.

Convenience header <boost/json.hpp>


PrevUpHomeNext