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

value

The type used to represent any JSON value.

Synopsis

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

class value;
Types

Name

Description

allocator_type

Associated Allocator

Member Functions

Name

Description

as_array

Return a reference to the underlying array, or throw an exception.

as_bool

Return a reference to the underlying bool, or throw an exception.

Return the underlying bool, or throw an exception.

as_double

Return a reference to the underlying double, or throw an exception.

Return the underlying double, or throw an exception.

as_int64

Return a reference to the underlying string, or throw an exception.

Return the underlying std::int64_t, or throw an exception.

as_object

Return a reference to the underlying object, or throw an exception.

as_string

Return a reference to the underlying string, or throw an exception.

as_uint64

Return a reference to the underlying std::uint64_t, or throw an exception.

Return the underlying std::uint64_t, or throw an exception.

at

Access an element, with bounds checking.

at_pointer

Access an element via JSON Pointer.

emplace_array

Return a reference to an array, changing the kind and replacing the contents.

emplace_bool

Return a reference to a bool, changing the kind and replacing the contents.

emplace_double

Return a reference to a double, changing the kind and replacing the contents.

emplace_int64

Return a reference to a std::int64_t, changing the kind and replacing the contents.

emplace_null

Change the kind to null, discarding the previous contents.

emplace_object

Return a reference to an object, changing the kind and replacing the contents.

emplace_string

Return a reference to a string, changing the kind and replacing the contents.

emplace_uint64

Return a reference to a std::uint64_t, changing the kind and replacing the contents.

find_pointer

Access an element via JSON Pointer.

get_allocator

Return the associated allocator.

get_array

Return a reference to the underlying array, without checking.

get_bool

Return a reference to the underlying bool, without checking.

Return the underlying bool, without checking.

get_double

Return a reference to the underlying double, without checking.

Return the underlying double, without checking.

get_int64

Return a reference to the underlying std::int64_t, without checking.

Return the underlying std::int64_t, without checking.

get_object

Return a reference to the underlying object, without checking.

get_string

Return a reference to the underlying string, without checking.

get_uint64

Return a reference to the underlying std::uint64_t, without checking.

Return the underlying std::uint64_t, without checking.

if_array

Return an array pointer if this is an array, else return nullptr

if_bool

Return a bool pointer if this is a boolean, else return nullptr

if_double

Return a double pointer if this is a double, else return nullptr

if_int64

Return an int64_t pointer if this is a signed integer, else return nullptr

if_object

Return an object pointer if this is an object, else return nullptr

if_string

Return a string pointer if this is a string, else return nullptr

if_uint64

Return a uint64_t pointer if this is an unsigned integer, else return nullptr

is_array

Return true if this is an array.

is_bool

Return true if this is a bool.

is_double

Return true if this is a double.

is_int64

Return true if this is a signed integer.

is_null

Returns true if this is a null.

is_number

Returns true if this is a number.

is_object

Return true if this is an object.

is_primitive

Returns true if this is not an array or object.

is_string

Return true if this is a string.

is_structured

Returns true if this is an array or object.

is_uint64

Return true if this is a unsigned integer.

kind

Returns the kind of this JSON value.

operator=

Assignment.

Copy assignment.

Move assignment.

set_at_pointer

Set an element via JSON Pointer.

storage

Return the associated memory resource.

swap

Swap the given values.

to_number

Return the stored number cast to an arithmetic type.

try_as_array

Return result with a reference to the underlying array.

try_as_bool

Return result with a reference to the underlying bool

Return result with the underlying bool

try_as_double

Return result with a reference to the underlying double

Return result with the underlying double

try_as_int64

Return result with a reference to the underlying std::int64_t

Return result with the underlying std::int64_t

try_as_null

Return engaged result if the value is null.

try_as_object

Return result with a reference to the underlying object.

try_as_string

Return result with a reference to the underlying string.

try_as_uint64

Return result with a reference to the underlying std::uint64_t

Return result with the underlying std::uint64_t

try_at

Access an element, with bounds checking.

try_at_pointer

Access an element via JSON Pointer.

try_set_at_pointer

Set an element via JSON Pointer.

try_to_number

Return the stored number as boost::system::result<T>.

value [constructor]

Default constructor.

Constructor.

Pilfer constructor.

Copy constructor.

Move constructor.

Construct a null.

Construct a bool.

Construct a std::int64_t.

Construct a std::uint64_t.

Construct a double.

Construct a string.

Construct an array.

Construct an object.

Construct from an initializer-list.

~value [destructor]

Destructor.

Friends

Name

Description

hash_value

Helper for boost::hash support.

operator!=

Return true if two values are not equal.

operator<<

Serialize value to an output stream.

operator==

Return true if two values are equal.

operator>>

Parse value from an input stream.

swap

Swap the given values.

Description

This is a Regular type which works like a variant of the basic JSON data types: array, object, string, number, boolean, and null.

Thread Safety

Distinct instances may be accessed concurrently. Non-const member functions of a shared instance may not be called concurrently with any other member functions of that instance.

Convenience header <boost/json.hpp>


PrevUpHomeNext