pretty

Function pretty 

Source
pub fn pretty(value: &Value) -> Result<String>
Expand description

Convert a Value to a pretty-printed JSON string

§Examples

use ruchy::stdlib::json;

let value = json::parse(r#"{"key":"value"}"#)?;
let pretty = json::pretty(&value)?;
assert!(pretty.contains('\n'));

§Errors

Returns error if the value cannot be serialized

§Complexity

Complexity: 1 (within Toyota Way limits ≤10)