Expand description
A JSON (compact) serde serializer for ser-write and a JSON deserializer for convenience.
Serializer types:
| Serde type -> | JSON type |
|---|---|
() | null |
Unit struct | null |
bool | boolean |
NewType(T) | T -> JSON |
None | null |
Some(T) | T -> JSON |
u8-u64 | number |
i8-i64 | number |
f23,f64 | number |
str | string |
bytes | (configurable) |
array, tuple | array |
seq-like | array |
map-like | object |
struct | object |
unit variant | string |
newtype variant | {"Name":T -> JSON} |
tuple variant | {"Name": array} |
struct variant | {"Name": object} |
Serializersupports serializing map keys as JSON strings from integers, chars, bools and C-like enums.
Deserializer types:
| JSON type -> | Serde type (depending on context) |
|---|---|
null | unit,none,NaN |
boolean | bool |
number | f64,f32,u8-u64,i8-i64 |
string | str,bytes (configurable),enum variant |
array | array,tuple,tuple struct,typle variant,seq-like,struct |
object | enum variant,struct variant,map-like,struct |
T | NewType(JSON -> T), Some(JSON -> T) |
Deserializersupports self-describing formats (deserialize_any).Deserializerdeserializes structs from both JSON objects or arrays.Deserializerdeserializes maps with integer, char, bool or C-like enum keys from JSON object’s string keys.
Re-exports§
pub use ser::to_string;stdorallocpub use ser::to_string_hex_bytes;stdorallocpub use ser::to_string_base64_bytes;stdorallocpub use ser::to_string_pass_bytes;stdorallocpub use ser::to_writer_with_encoder;pub use ser::to_writer;pub use ser::to_writer_hex_bytes;pub use ser::to_writer_base64_bytes;pub use ser::to_writer_pass_bytes;pub use de::from_mut_slice_with_decoder;pub use de::from_mut_slice;pub use de::from_mut_slice_hex_bytes;pub use de::from_mut_slice_base64_bytes;pub use ser_write;
Modules§
Traits§
- SerWrite
- Serializers should write data to the implementations of this trait.