#serde #serialization

serde_test

Token De/Serializer for testing De/Serialize implementations

150 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.8.0 Jul 28, 2016

#7 in Encoding

Download history 16997/week @ 2019-04-03 19863/week @ 2019-04-10 17420/week @ 2019-04-17 16907/week @ 2019-04-24 14543/week @ 2019-05-01 16122/week @ 2019-05-08 20231/week @ 2019-05-15 18523/week @ 2019-05-22 20741/week @ 2019-05-29 17452/week @ 2019-06-05 16729/week @ 2019-06-12 17574/week @ 2019-06-19 19848/week @ 2019-06-26 19970/week @ 2019-07-03 19716/week @ 2019-07-10

77,599 downloads per month
Used in 142 crates (92 directly)

MIT/Apache

398KB
8K 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