#serde #rusoto #dynamodb #dynamo #serde-dynamodb


serde serializer/deserializer for DynamoDB items

8 releases (stable)

Uses new Rust 2021

new 3.0.0-alpha.1 Nov 23, 2021
2.4.0 Jul 7, 2021
2.3.0 Apr 23, 2021
2.2.0 Mar 19, 2021
1.0.0 Dec 21, 2020

#42 in Database interfaces

Download history 1011/week @ 2021-08-10 1091/week @ 2021-08-17 804/week @ 2021-08-24 897/week @ 2021-08-31 1291/week @ 2021-09-07 1343/week @ 2021-09-14 1854/week @ 2021-09-21 1235/week @ 2021-09-28 1377/week @ 2021-10-05 1353/week @ 2021-10-12 1103/week @ 2021-10-19 1285/week @ 2021-10-26 1055/week @ 2021-11-02 1514/week @ 2021-11-09 1522/week @ 2021-11-16 938/week @ 2021-11-23

5,187 downloads per month

MIT license


DynamoDB is an AWS database that stores key/value and document data.

The most common way to access DynamoDB data from Rust is to use rusoto_dynamodb's get_item, put_item, and related methods.

serde_dynamo provides a way to serialize and deserialize between data stored in these items and strongly-typed Rust data structures.

You may be looking for


See the docs for more examples.

Parsing items as strongly-typed data structures.

Items received from a rusoto_dynamodb call can be run through from_items.

#[derive(Serialize, Deserialize)]
pub struct User {
    id: String,
    name: String,
    age: u8,

// Get documents from DynamoDB
let input = ScanInput {
    table_name: "users".to_string(),
let result = client.scan(input).await?;

// And deserialize them as strongly-typed data structures
if let Some(items) = result.items {
    let users: Vec<User> = from_items(items)?;
    println!("Got {} users", users.len());

Alternatively, to deserialize one item at a time, from_item can be used.

for item in result.items.unwrap() {
    let user: User = from_item(item)?;
    println!("{} is {}", user.name, user.age);

Creating items by serializing data structures

Writing an entire data structure to DynamoDB typically involves using to_item to serialize it.

#[derive(Serialize, Deserialize)]
pub struct User {
    id: String,
    name: String,
    age: u8,

// Create a user
let user = User {
    id: "fSsgVtal8TpP".to_string(),
    name: "Arthur Dent".to_string(),
    age: 42,

// Turn it into an item that rusoto understands
let item = to_item(user)?;

// And write it!
let input = PutItemInput {
    table_name: "users".to_string(),
    item: item,

How serde_dynamo compares to serde_dynamodb

serde_dynamodb is an effective library for serializing and deserializing data from rusoto_dynamodb.

However, serde_dynamodb is unable to handle some of the more advanced features of serde – especially features like flattening, adjacently tagged enums, and untagged enums – that we would like to use.

We opted to create a new library instead of making changes to serde_dynamodb because making the changes to support these features would cause serde_dynamodb to be backward-incompatible. Specifically, for certain cases, serde_dynamo and serde_dynamodb make different choices on how to serialize the exact same serializable structure.


~208K SLoC