#serde #serialization #no_std

macro no-std serde_derive

Macros 1.1 implementation of #[derive(Serialize, Deserialize)]

138 releases (stable)

new 1.0.97 Jul 17, 2019
1.0.94 Jun 27, 2019
1.0.89 Mar 1, 2019
1.0.83 Dec 28, 2018
0.8.19 Nov 23, 2016

#11 in Encoding

Download history 130497/week @ 2019-04-03 119684/week @ 2019-04-10 99661/week @ 2019-04-17 104175/week @ 2019-04-24 101236/week @ 2019-05-01 120899/week @ 2019-05-08 121322/week @ 2019-05-15 124924/week @ 2019-05-22 138474/week @ 2019-05-29 134317/week @ 2019-06-05 130357/week @ 2019-06-12 129126/week @ 2019-06-19 142489/week @ 2019-06-26 117178/week @ 2019-07-03 120957/week @ 2019-07-10

523,893 downloads per month
Used in 6,079 crates (3,417 directly)

MIT/Apache

275KB
6.5K SLoC

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.


You may be looking for:

Serde in action

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let point = Point { x: 1, y: 2 };

    // Convert the Point to a JSON string.
    let serialized = serde_json::to_string(&point).unwrap();

    // Prints serialized = {"x":1,"y":2}
    println!("serialized = {}", serialized);

    // Convert the JSON string back to a Point.
    let deserialized: Point = serde_json::from_str(&serialized).unwrap();

    // Prints deserialized = Point { x: 1, y: 2 }
    println!("deserialized = {:?}", deserialized);
}

Getting help

Serde developers live in the #serde channel on irc.mozilla.org. The #rust channel is also a good resource with generally faster response time but less specific knowledge about Serde. If IRC is not your thing or you don't get a good response, we are happy to respond to GitHub issues as well.

Dependencies

~753KB
~17K SLoC