{"id":6340,"date":"2019-12-13T03:09:02","date_gmt":"2019-12-13T03:09:02","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=6322"},"modified":"2020-03-30T02:37:47","modified_gmt":"2020-03-30T02:37:47","slug":"dynamodb-putitem-in-javascript-example","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/dynamodb-putitem-in-javascript-example\/","title":{"rendered":"DynamoDB putItem in Javascript example"},"content":{"rendered":"<p>DynamoDB requires a custom JSON format &#8211; this will convert a POJO to that format and save it, returning a promise:<\/p>\n<pre lang=\"javascript\">dynamodb.putItem({\n  Item: AWS.DynamoDB.Converter.marshall(recordToSave),\n   TableName: tables[type]\n}).promise()\n<\/pre>\n<p>Note that if you use dates, you&#8217;ll need to first marshal them to a suitable format (number or string) and un-marshal them on the way out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Save an item to DynamoDB from javascript<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4,8],"tags":[71,302],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6340"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=6340"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6340\/revisions"}],"predecessor-version":[{"id":6445,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6340\/revisions\/6445"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=6340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=6340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=6340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}