1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/* [dependencies] serde_json = "1.0.64" */ use serde_json::{Result, Value}; /// # Example: /// /// ``` /// let result = json_decode(r#"{"name":"Tufik", "age":99}"#).unwrap(); /// println!("{:?}", result["name"]); /// ``` pub fn json_decode(string:&str) -> Result<Value> { let result: Value = serde_json::from_str(string)?; Ok(result) } pub fn test(string:&str) -> &str{ return string; }