serialization
Turning a value into text or bytes to store or send it, and back again.
Serialization converts in-memory values to a data format (JSON, TOML, bytes) and deserialization parses them back; serde separates the data types (Serialize/Deserialize) from the formats (serde_json, toml...).
Loading interactive…
Examples
With
#[derive(Serialize, Deserialize)],serde_json::to_string(&r)?writes{"sensor":"porch","celsius":21.5}, andserde_json::from_str::<Reading>(&text)?reads it back.
See also