|
| json_value () noexcept |
| Creates a null JSON value.
|
|
| json_value (const detail::json::value *val, detail::json::storage_ptr sptr) noexcept |
|
| json_value (json_value &&) noexcept=default |
|
| json_value (const json_value &) noexcept=default |
|
json_value & | operator= (json_value &&) noexcept=default |
|
json_value & | operator= (const json_value &) noexcept=default |
|
bool | is_null () const noexcept |
| Checks whether the value is null .
|
|
bool | is_undefined () const noexcept |
| Checks whether the value is undefined.
|
|
bool | is_integer () const noexcept |
| Checks whether the value is an int64_t .
|
|
bool | is_unsigned () const noexcept |
| Checks whether the value is an uint64_t .
|
|
bool | is_double () const noexcept |
| Checks whether the value is a double .
|
|
bool | is_number () const noexcept |
| Checks whether the value is a number, i.e., an int64_t , a uint64_t or a double .
|
|
bool | is_bool () const noexcept |
| Checks whether the value is a bool .
|
|
bool | is_string () const noexcept |
| Checks whether the value is a JSON string (std::string_view ).
|
|
bool | is_array () const noexcept |
| Checks whether the value is an JSON array.
|
|
bool | is_object () const noexcept |
| Checks whether the value is a JSON object.
|
|
int64_t | to_integer (int64_t fallback=0) const |
| Converts the value to an int64_t or returns fallback if the value is not a valid number.
|
|
uint64_t | to_unsigned (uint64_t fallback=0) const |
| Converts the value to an uint64_t or returns fallback if the value is not a valid number.
|
|
double | to_double (double fallback=0.0) const |
| Converts the value to a double or returns fallback if the value is not a valid number.
|
|
bool | to_bool (bool fallback=false) const |
| Converts the value to a bool or returns fallback if the value is not a valid boolean.
|
|
std::string_view | to_string () const |
| Returns the value as a JSON string or an empty string if the value is not a string.
|
|
std::string_view | to_string (std::string_view fallback) const |
| Returns the value as a JSON string or fallback if the value is not a string.
|
|
json_array | to_array () const |
| Returns the value as a JSON array or an empty array if the value is not an array.
|
|
json_array | to_array (json_array fallback) const |
| Returns the value as a JSON array or fallback if the value is not an array.
|
|
json_object | to_object () const |
| Returns the value as a JSON object or an empty object if the value is not an object.
|
|
json_object | to_object (json_object fallback) const |
| Returns the value as a JSON object or fallback if the value is not an object.
|
|
bool | equal_to (const json_value &other) const noexcept |
| Compares two JSON values for equality.
|
|
template<class Buffer > |
void | print_to (Buffer &buf, size_t indentation_factor=0) const |
| Prints the JSON value to buf .
|
|
|
static json_value | undefined () noexcept |
| Creates an undefined JSON value.
|
|
static expected< json_value > | parse (std::string_view str) |
| Attempts to parse str as JSON input into a self-contained value.
|
|
static expected< json_value > | parse_shallow (std::string_view str) |
| Attempts to parse str as JSON input into a value that avoids copies where possible by pointing into str .
|
|
static expected< json_value > | parse_in_situ (std::string &str) |
| Attempts to parse str as JSON input.
|
|
static expected< json_value > | parse_file (const char *path) |
| Attempts to parse the content of the file at path as JSON input into a self-contained value.
|
|
static expected< json_value > | parse_file (const std::string &path) |
| Attempts to parse the content of the file at path as JSON input into a self-contained value.
|
|
Represents an immutable JSON value.