pub trait ToJSON: Type {
// Required method
fn to_json(&self) -> Option<Value>;
// Provided method
fn to_json_string(&self) -> String { ... }
}Expand description
Represents a type that can converted to JSON value.
Required Methods§
Provided Methods§
Sourcefn to_json_string(&self) -> String
fn to_json_string(&self) -> String
Convert this value to JSON string.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ToJSON for DateTime<FixedOffset>
Available on crate feature chrono only.
impl ToJSON for DateTime<FixedOffset>
Available on crate feature
chrono only.Source§impl ToJSON for NaiveDateTime
Available on crate feature chrono only.
impl ToJSON for NaiveDateTime
Available on crate feature
chrono only.Source§impl ToJSON for LineString
Available on crate feature geo only.
impl ToJSON for LineString
Available on crate feature
geo only.Source§impl ToJSON for MultiLineString
Available on crate feature geo only.
impl ToJSON for MultiLineString
Available on crate feature
geo only.Source§impl ToJSON for MultiPoint
Available on crate feature geo only.
impl ToJSON for MultiPoint
Available on crate feature
geo only.Source§impl ToJSON for MultiPolygon
Available on crate feature geo only.
impl ToJSON for MultiPolygon
Available on crate feature
geo only.Source§impl ToJSON for OffsetDateTime
Available on crate feature time only.
impl ToJSON for OffsetDateTime
Available on crate feature
time only.Source§impl ToJSON for PrimitiveDateTime
Available on crate feature time only.
impl ToJSON for PrimitiveDateTime
Available on crate feature
time only.