Skip to main content

ToJson

Trait ToJson 

Source
pub trait ToJson {
    // Provided methods
    fn to_json(&self) -> Result<String>
       where Self: Serialize { ... }
    fn to_json_pretty(&self) -> Result<String>
       where Self: Serialize { ... }
}
Expand description

A trate with functions for converting data from a structure or other object to the JSON format

Provided Methods§

Source

fn to_json(&self) -> Result<String>
where Self: Serialize,

Convert object data to machine-readable JSON format (without unnecessary indentation and newline transitions)

Source

fn to_json_pretty(&self) -> Result<String>
where Self: Serialize,

Convert object data to human-readable JSON format (“pretty”; with additional newline transitions and indentation)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§