Rust's framework for serializing and deserializing data structures
open sourceMIT OR Apache-2.0free
Serde is the standard framework for serializing and deserializing Rust data structures efficiently and generically. Types implement its Serialize and Deserialize traits, usually generated at compile time with #[derive(Serialize, Deserialize)], and data formats implement the other side, so any supported type works with any supported format. It's built on Rust's trait system instead of runtime reflection, so serialization often compiles down to the speed of a handwritten serializer. The serde_json crate is its JSON implementation, and the community has written formats for YAML, TOML, MessagePack, CBOR, BSON, Avro, Postcard, RON, Pickle, URL query strings and many more. Attributes customise field names, defaults, skipping and enum representations.
Problems it solves
- parse JSON into Rust structs
- serialize my Rust types to JSON, YAML or TOML
- read a config file into a typed Rust struct
- one serialization layer that works across many data formats in Rust
Features
- Serialize and Deserialize traits with derive macros
- no runtime reflection
- serde_json for JSON
- community formats: YAML, TOML, MessagePack, CBOR, BSON, Avro, RON and more
- attributes for renaming, defaults, skipping and enum representations
Alternatives
The same job
These do what Serde does.
- FlatBuffers A memory-efficient cross-platform serialization library
