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

PrevUpHomeNext
parse (6 of 6 overloads)

Return parsed JSON as a value.

Synopsis

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

value
parse(
    std::istream& is,
    storage_ptr sp = {},
    parse_options const& opt = {});
Description

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 exception is thrown.

Complexity

Linear in the size of consumed input.

Exception Safety

Basic guarantee. Throws boost::system::system_error on failed parse. Calls to memory_resource::allocate may throw. The stream may throw as described by std::ios::exceptions.

Return Value

A value representing the parsed JSON upon success.

Parameters

Name

Description

is

The stream to read from.

sp

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.

opt

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

See Also

parse_options, stream_parser, value::operator>>.

Convenience header <boost/json.hpp>


PrevUpHomeNext