fn convert_to_json(v: &Value) -> String {
    match &*v {
        Value::Null => "null".to_string(),
        Value::Int(n) => n.to_string(),
        Value::Float(f) => f.to_string(),
        Value::String(s, _) => {
            format!("\"{}\"", s)
        }
        Value::List(lst) => {
            let s = lst
                .iter()
                .map(|v_rr| convert_to_json(&v_rr.borrow()))
                .collect::<Vec<_>>()
                .join(",");
            format!("[{}]", s)
        }
        Value::Hash(vm) => {
            let s = vm
                .iter()
                .map(|(k, v_rr)| {
                    format!("\"{}\":{}", k, convert_to_json(&v_rr.borrow()))
                })
                .collect::<Vec<_>>()
                .join(",");
            format!("{{{}}}", s)
        }
        _ => "".to_string(),
    }
}
/// Convert a value into a JSON string.
Convert a value into a JSON string.
Convert a value into a JSON string .
fn convert_to_json(v: &Value) -> String {
    match &*v {
        Value::Null => "null".to_string(),
        Value::Int(n) => n.to_string(),
        Value::Float(f) => f.to_string(),
        Value::String(s, _) => {
            format!("\"{}\"", s)
        }
        Value::List(lst) => {
            let s = lst
                .iter()
                .map(|v_rr| convert_to_json(&v_rr.borrow()))
                .collect::<Vec<_>>()
                .join(",");
            format!("[{}]", s)
        }
        Value::Hash(vm) => {
            let s = vm
                .iter()
                .map(|(k, v_rr)| {
                    format!("\"{}\":{}", k, convert_to_json(&v_rr.borrow()))
                })
                .collect::<Vec<_>>()
                .join(",");
            format!("{{{}}}", s)
        }
        _ => "".to_string(),
    }
}
fn convert_to_json ( v : & Value ) -> String { match & * v { Value :: Null => " " . to_string ( ) , Value :: Int ( n ) => n . to_string ( ) , Value :: Float ( f ) => f . to_string ( ) , Value :: String ( s , _ ) => { format ! ( " \" \" " s ) } Value :: List ( lst ) => { let s = lst . iter ( ) . map ( | v_rr | convert_to_json ( & v_rr . borrow ( ) ) ) . collect :: < Vec < _ > > ( ) . join ( " " ) ; format ! ( " " s ) } Value :: Hash ( vm ) => { let s = vm . iter ( ) . map ( | ( k , v_rr ) | { format ! ( " \" \" " k convert_to_json ( v_rr borrow ( ) ) ) } ) . collect :: < Vec < _ > > ( ) . join ( " " ) ; format ! ( " " s ) } _ => " " . to_string ( ) , } }
Convert a value into a JSON string.
Convert a value into a JSON string .
v
&Value