pub fn to_string(value: impl Into<Value>) -> StringExpand description
Converts a value into a JSON string.
§Arguments
value- A value that can be converted intoserde_json::Value.
§Returns
- A
Stringrepresentation of the JSON value. - If the value is a boolean, it converts
trueto1andfalseto0.
§Example
let json_string = to_string(true);
assert_eq!(json_string, "1");
let json_string = to_string("Hello");
assert_eq!(json_string, "\"Hello\"");