pub fn format(value: &JsonValue) -> JsonGenerateResult
Expand description
Serialize the given JsonValue
value to String
with 2-spaces indentation. This method is almost identical to
JsonValue::format
but exists for a historical reason.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), 2.0.into(), 3.0.into()]);
let s = tinyjson::format(&v).unwrap();
assert_eq!(s, "[\n 1,\n 2,\n 3\n]");