#serde-json #pair #json #map #serialization #serde

yanked json_map_serializer

Crate for easy serializing json maps from sequense of pairs

0.1.3 Sep 7, 2022

#40 in #serialize

MIT license

18KB
486 lines

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);
}

lib.rs:

This library provides to_map for simple converting maps and sequenses of pairs to serde_json::Map

Example

Dependencies

~0.7–1.6MB
~35K SLoC