| Crates.io | musli-json |
| lib.rs | musli-json |
| version | 0.0.117 |
| created_at | 2022-04-28 20:27:24.392812+00 |
| updated_at | 2024-04-20 08:47:40.353732+00 |
| description | JSON support for Müsli. |
| homepage | https://github.com/udoprog/musli |
| repository | https://github.com/udoprog/musli |
| max_upload_size | |
| id | 576996 |
| size | 144,349 |
JSON support for Müsli suitable for network and usually browser communication.
JSON encoding is fully upgrade stable:
#[musli(default)].use musli::{Encode, Decode};
#[derive(Debug, PartialEq, Encode, Decode)]
struct Version1 {
name: String,
}
#[derive(Debug, PartialEq, Encode, Decode)]
struct Version2 {
name: String,
#[musli(default)]
age: Option<u32>,
}
let version2 = musli_json::to_vec(&Version2 {
name: String::from("Aristotle"),
age: Some(62),
})?;
let version1: Version1 = musli_json::from_slice(version2.as_slice())?;
assert_eq!(version1, Version1 {
name: String::from("Aristotle"),
});