use std::collections::HashMap;
use std::io::Result;
use jsonxs::{JsonXsSerializer, JsonXsValue};
pub fn json_save(map: &HashMap<String, String>) -> Result<()> {
let mut json = JsonXsSerializer::use_stdout();
json.open_obj(JsonXsValue::NA)?;
json.open_obj("map")?;
for (k, v) in map {
json.element(k, v)?;
}
json.close()?;
json.close()?; json.done() }
fn main() {
let mut map = HashMap::new();
map.insert("hello".to_string(), "world".to_string());
map.insert("how".to_string(), "are you".to_string());
json_save(&map).unwrap();
}