pub type JsonValue = Value;
Expand description
A JSON value.
Aliased Type§
enum JsonValue {
// some variants omitted
}
Variants§
Trait Implementations§
source§impl JsonValueExt for JsonValue
impl JsonValueExt for JsonValue
source§fn is_ignorable(&self) -> bool
fn is_ignorable(&self) -> bool
Returns
true
if the JSON value can be ignored.source§fn as_u8(&self) -> Option<u8>
fn as_u8(&self) -> Option<u8>
If the
Value
is an integer, represent it as u8
if possible.
Returns None
otherwise.source§fn as_u16(&self) -> Option<u16>
fn as_u16(&self) -> Option<u16>
If the
Value
is an integer, represent it as u16
if possible.
Returns None
otherwise.source§fn as_u32(&self) -> Option<u32>
fn as_u32(&self) -> Option<u32>
If the
Value
is an integer, represent it as u32
if possible.
Returns None
otherwise.source§fn as_usize(&self) -> Option<usize>
fn as_usize(&self) -> Option<usize>
If the
Value
is an integer, represent it as usize
if possible.
Returns None
otherwise.source§fn as_i8(&self) -> Option<i8>
fn as_i8(&self) -> Option<i8>
If the
Value
is an integer, represent it as i8
if possible.
Returns None
otherwise.source§fn as_i16(&self) -> Option<i16>
fn as_i16(&self) -> Option<i16>
If the
Value
is an integer, represent it as i16
if possible.
Returns None
otherwise.source§fn as_i32(&self) -> Option<i32>
fn as_i32(&self) -> Option<i32>
If the
Value
is an integer, represent it as i32
if possible.
Returns None
otherwise.source§fn as_isize(&self) -> Option<isize>
fn as_isize(&self) -> Option<isize>
If the
Value
is an integer, represent it as isize
if possible.
Returns None
otherwise.source§fn as_f32(&self) -> Option<f32>
fn as_f32(&self) -> Option<f32>
If the
Value
is a float, represent it as f32
if possible.
Returns None
otherwise.source§fn as_str_array(&self) -> Option<Vec<&str>>
fn as_str_array(&self) -> Option<Vec<&str>>
If the
Value
is an array of strings, returns the associated vector.
Returns None
otherwise.source§fn as_map_array(&self) -> Option<Vec<&Map>>
fn as_map_array(&self) -> Option<Vec<&Map>>
If the
Value
is an array of maps, returns the associated vector.
Returns None
otherwise.source§fn as_uuid(&self) -> Option<Uuid>
fn as_uuid(&self) -> Option<Uuid>
If the
Value
is a String, represent it as Uuid
if possible.
Returns None
otherwise.source§fn as_date(&self) -> Option<Date>
fn as_date(&self) -> Option<Date>
If the
Value
is a String, represent it as Date
if possible.
Returns None
otherwise.source§fn as_time(&self) -> Option<Time>
fn as_time(&self) -> Option<Time>
If the
Value
is a String, represent it as Time
if possible.
Returns None
otherwise.source§fn as_datetime(&self) -> Option<DateTime>
fn as_datetime(&self) -> Option<DateTime>
If the
Value
is a String, represent it as DateTime
if possible.
Returns None
otherwise.source§fn as_duration(&self) -> Option<Duration>
fn as_duration(&self) -> Option<Duration>
If the
Value
is a String, represent it as Duration
if possible.
Returns None
otherwise.source§fn parse_bool(&self) -> Option<Result<bool, ParseBoolError>>
fn parse_bool(&self) -> Option<Result<bool, ParseBoolError>>
Parses the JSON value as
bool
.source§fn parse_usize(&self) -> Option<Result<usize, ParseIntError>>
fn parse_usize(&self) -> Option<Result<usize, ParseIntError>>
Parses the JSON value as
usize
.source§fn parse_isize(&self) -> Option<Result<isize, ParseIntError>>
fn parse_isize(&self) -> Option<Result<isize, ParseIntError>>
Parses the JSON value as
isize
.source§fn parse_string(&self) -> Option<Cow<'_, str>>
fn parse_string(&self) -> Option<Cow<'_, str>>
Parses the JSON value as
Cow<'_, str>
.
If the str is empty, it also returns None
.source§fn parse_array<T: FromStr>(&self) -> Option<Result<Vec<T>, <T as FromStr>::Err>>
fn parse_array<T: FromStr>(&self) -> Option<Result<Vec<T>, <T as FromStr>::Err>>
Parses the JSON value as
Vec<T>
.
If the vec is empty, it also returns None
.source§fn parse_str_array(&self) -> Option<Vec<&str>>
fn parse_str_array(&self) -> Option<Vec<&str>>
Parses the JSON value as
Vec<&str>
.
If the vec is empty, it also returns None
.source§fn parse_uuid(&self) -> Option<Result<Uuid, Error>>
fn parse_uuid(&self) -> Option<Result<Uuid, Error>>
Parses the JSON value as
Uuid
.
If the Uuid
is nil
, it also returns None
.source§fn parse_date(&self) -> Option<Result<Date, ParseError>>
fn parse_date(&self) -> Option<Result<Date, ParseError>>
Parses the JSON value as
Date
.source§fn parse_time(&self) -> Option<Result<Time, ParseError>>
fn parse_time(&self) -> Option<Result<Time, ParseError>>
Parses the JSON value as
Time
.source§fn parse_datetime(&self) -> Option<Result<DateTime, ParseError>>
fn parse_datetime(&self) -> Option<Result<DateTime, ParseError>>
Parses the JSON value as
DateTime
.source§fn parse_duration(&self) -> Option<Result<Duration, ParseDurationError>>
fn parse_duration(&self) -> Option<Result<Duration, ParseDurationError>>
Parses the JSON value as
Duration
.source§fn to_string_pretty(&self) -> String
fn to_string_pretty(&self) -> String
Returns a pretty-printed String of JSON.
source§fn to_string_unquoted(&self) -> String
fn to_string_unquoted(&self) -> String
Returns a unquoted String of JSON.
source§fn to_csv(&self, buffer: Vec<u8>) -> Result<Vec<u8>, Error>
fn to_csv(&self, buffer: Vec<u8>) -> Result<Vec<u8>, Error>
Attempts to convert the JSON value to the CSV bytes.
source§fn to_jsonlines(&self, buffer: Vec<u8>) -> Result<Vec<u8>, Error>
fn to_jsonlines(&self, buffer: Vec<u8>) -> Result<Vec<u8>, Error>
Attempts to convert the JSON value to the JSON Lines bytes.
source§fn deserialize<T: DeserializeOwned>(self) -> Result<T, Error>
fn deserialize<T: DeserializeOwned>(self) -> Result<T, Error>
Attempts to deserialize the JSON value as an instance of type
T
.source§fn into_map_array(self) -> Vec<Map>
fn into_map_array(self) -> Vec<Map>
Converts
self
into a map array.source§fn into_map_opt(self) -> Option<Map>
fn into_map_opt(self) -> Option<Map>
Converts
self
into a map option.