Function json::to_bytes

Overview
fn to_bytes(value: any) -> Result

Convert any value to json bytes.

Examples

let object = #{"number": 42, "string": "Hello World"};
let object = json::from_bytes(json::to_bytes(object)?)?;
assert_eq!(object, #{"number": 42, "string": "Hello World"});