Crates.io | nested_qs |
lib.rs | nested_qs |
version | 0.1.2 |
source | src |
created_at | 2017-11-09 20:42:54.084197 |
updated_at | 2020-07-06 22:09:16.641601 |
description | Serializing/deserializing nested style querystrings with serde |
homepage | |
repository | https://github.com/kardeiz/nested_qs |
max_upload_size | |
id | 38774 |
size | 24,888 |
Deserializes x-www-form-urlencoded
strings/bytes into deserializable structs and vice versa.
Similar to and inspired by serde_qs
.
Defers pretty much everything except key parsing to url::form_urlencoded
and serde_json
.
serde_json::Value
is used as an intermediate object between the string and your struct. However, this is not
as expensive as might be expected (you'll probably need to allocate a few strings anyway if you have any pluses
or encoded chars in your querystring). Some casual benchmarking indicates it performs well in comparison to serde_qs
.
Using serde_json::Value
like this does not mean that JSON is used in the process. No JSON strings are involved at
any point.
Use like:
let decoded: MyStruct = nested_qs::from_str(&encoded)?;
let encoded = nested_qs::to_string(&decoded)?;