DynamoDB putItem in Javascript example

DynamoDB requires a custom JSON format – this will convert a POJO to that format and save it, returning a promise:

  Item: AWS.DynamoDB.Converter.marshall(recordToSave),
   TableName: tables[type]

Note that if you use dates, you’ll need to first marshal them to a suitable format (number or string) and un-marshal them on the way out.