use serde::{Deserialize, Serialize}; #[derive(Debug, PartialEq, Serialize, Deserialize)] struct ServiceConfig { name: String, enabled: bool, retries: i64, endpoints: Vec, } fn main() -> wson::Result<()> { let value = ServiceConfig { name: "worker".to_string(), enabled: true, retries: 3, endpoints: vec![ "https://a.example".to_string(), "https://b.example".to_string(), ], }; let bytes = wson::to_vec(&value)?; println!("jbon length: {} bytes", bytes.len()); println!("jbon prefix: {:02x?}", &bytes[..bytes.len().min(16)]); let decoded: ServiceConfig = wson::from_slice(&bytes)?; assert_eq!(decoded, value); println!("round trip ok"); Ok(()) }