json_map_serializer

Crates.iojson_map_serializer
lib.rsjson_map_serializer
version0.1.3
sourcesrc
created_at2022-09-07 16:24:17.475409
updated_at2022-09-07 16:24:17.475409
descriptionCrate for easy serializing json maps from sequense of pairs
homepage
repositoryhttps://github.com/Trard/json_map_serializer
max_upload_size
id660483
size19,158
Eduard Baturin (Trard)

documentation

https://docs.rs/json_map_serializer

README

Json Map Serializer

This library provides to_map for easy serializing maps and sequenses of pairs to serde_json::Map

Example

use json_map_serializer::to_map;
use serde_json::Value;

fn main() {
    let query = (("foo", "bar"), ("baz", "qux"));
 
   let map = to_map(query).unwrap();

   let mut result = serde_json::Map::new();
   result.insert(String::from("foo"), Value::String(String::from("bar")));
   result.insert(String::from("baz"), Value::String(String::from("qux")));
 
  assert_eq!(result, map);
}
Commit count: 0

cargo fmt