#serde #serialization #no_std

no-std serde

A generic serialization/deserialization framework

183 releases (98 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.0.0 Dec 5, 2014

#4 in Encoding

Download history 143612/week @ 2019-04-03 140725/week @ 2019-04-10 118177/week @ 2019-04-17 124262/week @ 2019-04-24 119504/week @ 2019-05-01 141877/week @ 2019-05-08 142880/week @ 2019-05-15 145637/week @ 2019-05-22 160876/week @ 2019-05-29 155524/week @ 2019-06-05 151403/week @ 2019-06-12 148706/week @ 2019-06-19 165389/week @ 2019-06-26 141427/week @ 2019-07-03 145079/week @ 2019-07-10

614,849 downloads per month
Used in 7,737 crates (4,688 directly)

MIT/Apache

473KB
10K 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