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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
parse (2 of 2 overloads)

Parse a string of JSON into a value.

Synopsis

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

value
parse(
    string_view s,
    storage_ptr sp = {},
    parse_options const& opt = {});
Description

This function parses an entire string in one step to produce a complete JSON object, returned as a value. If the buffer does not contain a complete serialized JSON, an exception is thrown.

Complexity

Linear in s.size().

Exception Safety

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

Return Value

A value representing the parsed JSON upon success.

Parameters

Name

Description

s

The string to parse.

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.

Exceptions

Type

Thrown On

system_error

Thrown on failure.

See Also

parse_options, stream_parser.

Convenience header <boost/json.hpp>


PrevUpHomeNext