dynamify-json-object

1.0.5 • Public • Published

Dynamify-Json-Object

Since Dynamodb uses a rather cumbersome json format to define its data, dynamify-json-object is a simple helper library that will help you convert your standard json object into DynamoDB accepted format. This will help you continue working with json format that you are already used to rather than worrying about dynamodb specific json convention.

Installation

Install this library as a dependency with npm tool.

$ npm install dynamify-json-object --save

Usage:

To use the library, use the following code to require and call dynamifyObject function.

const helper = require('dynamify-json-object');

helper.dynamifyObject({'name' :'Jackson','age':20,'enabled':true}, function(data){
    console.log(data);
});

Output:

{"name" : {"S":"Jackson"}, "age" : {"N":20}, "enabled" : {"B":true}}

Supported types:

| JavaScript types                                                       | DynamoDB Attribute Value |
|------------------------------------------------------------------------|--------------------------|
| String                                                                 | S                        |
| Number                                                                 | N                        |
| Boolean                                                                | BOOL                     |
| null                                                                   | NULL                     |
| Array                                                                  | L                        |
| Object                                                                 | M                        |
| Buffer, File, Blob, ArrayBuffer, DataView, and JavaScript typed arrays | B                        |

Readme

Keywords

Package Sidebar

Install

npm i dynamify-json-object

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • bychwa