Skip to main content

to_string_pretty

Function to_string_pretty 

Source
pub fn to_string_pretty<T>(value: &T, config: &Config) -> Result<String>
where T: ?Sized + Serialize,
Expand description

Serializes a value to a pretty-printed JSON string with the given configuration.

ยงExample

use serde_json_ext::{to_string_pretty, Config};

let config = Config::default().set_bytes_hex().enable_hex_prefix();
let json = to_string_pretty(&vec![1u8, 2u8, 3u8], &config).unwrap();