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 the underlying array, or throw an exception.

as_bool

Return the underlying bool, or throw an exception.

as_double

Return the underlying double, or throw an exception.

as_int64

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

as_object

Return the underlying object, or throw an exception.

as_string

Return the underlying string, or throw an exception.

as_uint64

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.

delete_at_pointer

Remove an element via JSON Pointer.

emplace_array

Replace with an empty array.

emplace_bool

Replace with a bool value.

emplace_double

Replace with a double value.

emplace_int64

Replace with a std::int64_t value.

emplace_null

Replace with a null value.

emplace_object

Replace with an empty object.

emplace_string

Replace with an empty string.

emplace_uint64

Replace with a std::uint64_t value.

find_pointer

Access an element via JSON Pointer.

get_allocator

Return the associated allocator.

get_array

Return the underlying array, without checking.

get_bool

Return the underlying bool, without checking.

get_double

Return the underlying double, without checking.

get_int64

Return the underlying std::int64_t, without checking.

get_object

Return the underlying object, without checking.

get_string

Return the underlying string, without checking.

get_uint64

Return the underlying std::uint64_t, without checking.

if_array

Return a pointer to the underlying array.

if_bool

Return a pointer to the underlying bool .

if_double

Return a pointer to the underlying double.

if_int64

Return a pointer to the underlying std::int64_t.

if_object

Return a pointer to the underlying object.

if_string

Return a pointer to the underlying string.

if_uint64

Return a pointer to the underlying std::uint64_t.

is_array

Check if this is an array.

is_bool

Check if this is a bool.

is_double

Check if this is a double.

is_int64

Check if this is a std::int64_t.

is_null

Check if this is a null value.

is_number

Check if this is a number.

is_object

Check if this is an object.

is_primitive

Check if this is not an array or object.

is_string

Check if this is a string.

is_structured

Checks if this is an array or an object.

is_uint64

Checks if this is a std::uint64_t.

kind

Returns the kind of this JSON value.

operator=

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 the underlying bool

try_as_double

Return result with the underlying double

try_as_int64

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 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.

value [constructor]

Constructors.

~value [destructor]

Destructor.

Friends

Name Description

hash_value

Helper for boost::hash support.

operator!=

Check if two values are not equal.

operator<<

Serialize value to an output stream.

operator==

Check 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>.