pub fn json_encode(value: Value, args: HashMap<String, Value>) -> Result<Value> {
    let pretty = args.get("pretty").and_then(|v| v.as_bool()).unwrap_or(false);

    if pretty {
        Ok(Value::String(to_string_pretty(&value)?))
    } else {
        Ok(Value::String(to_string(&value)?))
    }
}
// Encodes a value of any type into json, optionally `pretty`-printing it
// `pretty` can be true to enable pretty-print, or omitted for compact printing
Encodes a value of any type into json, optionally `pretty`-printing it
`pretty` can be true to enable pretty-print, or omitted for compact printing
Encodes a value of any type into json optionally ` pretty ` - printing it ` pretty ` can be true to enable pretty - print or omitted for compact printing
pub fn json_encode(value: Value, args: HashMap<String, Value>) -> Result<Value> {
    let pretty = args.get("pretty").and_then(|v| v.as_bool()).unwrap_or(false);
    if pretty {
        Ok(Value::String(to_string_pretty(&value)?))
    } else {
        Ok(Value::String(to_string(&value)?))
    }
}
pub fn json_encode ( value : Value , args : HashMap < String , Value > ) -> Result < Value > { let pretty = args . get ( " " ) . and_then ( | v | v . as_bool ( ) ) . unwrap_or ( false ) ; if pretty { Ok ( Value :: String ( to_string_pretty ( & value ) ? ) ) } else { Ok ( Value :: String ( to_string ( & value ) ? ) ) } }
Encodes a value of any type into json, optionally `pretty`-printing it
`pretty` can be true to enable pretty-print, or omitted for compact printing
Encodes a value of any type into json optionally ` pretty ` - printing it ` pretty ` can be true to enable pretty - print or omitted for compact printing
value
Value
args
HashMap<String, Value>
value
Value
args
HashMap<String, Value>