You can use the DynamoDB client client SDK:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property
The document client simplifies working with elements in Amazon DynamoDB by abstracting the concept of attribute values. This abstraction annotates the native JavaScript types that are included as input parameters, since it also converts the annotated response data into native JavaScript types.
In your case, specifically look at the value of the map attribute (M) , which is passed as MapAttribute in the example below, extracted from the official documentation. The Client Client API takes care of proper sorting / disassembling between the Javascript and DynamoDB types (this means that you do not need to specify Attribute Values (S,N,L,...) , as required when using the document-based SDK):
var params = { TableName = 'Table', Item: { HashKey: 'haskey', NumAttribute: 1, BoolAttribute: true, ListAttribute: [1, 'two', false], MapAttribute: { foo: 'bar'}, NullAttribute: null } }; var docClient = new AWS.DynamoDB.DocumentClient(); docClient.put(params, function(err, data) { if (err) console.log(err); else console.log(data); });
bsd
source share