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 for the latest Boost documentation.
PrevUpHomeNext
value::operator>>

Parse value from an input stream.

Synopsis

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

friend std::istream&
operator>>(
    std::istream& is,
    value& jv);
Description

This function parses JSON from an input stream into a value. If parsing fails, std::ios_base::failbit will be set for is and jv will be left unchanged. Regardless of whether skipws flag is set on is, consumes whitespace before and after JSON, because whitespace is considered a part of JSON. Behaves as FormattedInputFunction.

Note: this operator cannot assume that the stream only contains a single JSON document, which may result in very underwhelming performance, if the stream isn't cooperative. If you know that your input consists of a single JSON document, consider using parse function instead.

Return Value

Reference to is.

Complexity

Linear in the size of JSON data.

Exception Safety

Basic guarantee. Calls to memory_resource::allocate may throw. The stream may throw as configured by std::ios::exceptions.

Parameters

Name

Description

is

The input stream to parse from.

jv

The value to parse into.

See Also

parse.

Convenience header <boost/json.hpp>


PrevUpHomeNext