to_string

Function to_string 

Source
pub fn to_string(value: impl Into<Value>) -> String
Expand description

Converts a value into a JSON string.

§Arguments

  • value - A value that can be converted into serde_json::Value.

§Returns

  • A String representation of the JSON value.
  • If the value is a boolean, it converts true to 1 and false to 0.

§Example

let json_string = to_string(true);
assert_eq!(json_string, "1");

let json_string = to_string("Hello");
assert_eq!(json_string, "\"Hello\"");