pub fn to_string<T: Serialize + ?Sized>(value: &T) -> Result<String, Error>Expand description
Serializes a value to JSON5.
The output is JSON, except for NaN and infinite floats which are
written as NaN, Infinity and -Infinity (the default
SerializerConfig writes them as null, see
SerializerConfig::set_non_finite_floats).
let value = vec![1.0, f64::INFINITY];
assert_eq!(deser_json5::to_string(&value).unwrap(), "[1.0,Infinity]");