@aws-sdk/util-dynamodb
TypeScript icon, indicating that this package has built-in type declarations

3.564.0 • Public • Published

@aws-sdk/util-dynamodb

NPM version NPM downloads

This package provides utilities to be used with @aws-sdk/client-dynamodb

If you are looking for DynamoDB Document client, please check @aws-sdk/lib-dynamodb which automatically performs the necessary marshalling and unmarshalling.

Convert JavaScript object into DynamoDB Record

const { DynamoDB } = require("@aws-sdk/client-dynamodb");
const { marshall } = require("@aws-sdk/util-dynamodb");

const client = new DynamoDB(clientParams);
const params = {
  TableName: "Table",
  Item: marshall({
    HashKey: "hashKey",
    NumAttribute: 1,
    BoolAttribute: true,
    ListAttribute: [1, "two", false],
    MapAttribute: { foo: "bar" },
    NullAttribute: null,
  }),
};

await client.putItem(params);

Convert DynamoDB Record into JavaScript object

const { DynamoDB } = require("@aws-sdk/client-dynamodb");
const { marshall, unmarshall } = require("@aws-sdk/util-dynamodb");

const client = new DynamoDB(clientParams);
const params = {
  TableName: "Table",
  Key: marshall({
    HashKey: "hashKey",
  }),
};

const { Item } = await client.getItem(params);
unmarshall(Item);

/@aws-sdk/util-dynamodb/

    Package Sidebar

    Install

    npm i @aws-sdk/util-dynamodb

    Weekly Downloads

    1,581,297

    Version

    3.564.0

    License

    Apache-2.0

    Unpacked Size

    50.4 kB

    Total Files

    31

    Last publish

    Collaborators

    • mattsb42-aws
    • kuhe
    • amzn-oss
    • aws-sdk-bot
    • trivikr-aws