DynamoDBDataTypes is available as a global variable.
Open your browser console and try it!
var data = {
name: 'Java Script',
age: 18,
fav: {
food: ['Rice', 'Noodles'],
colors: ['Orange', 'Blue']
},
engines: [ 'Rhino', 'v8', 'SpiderMonkey', 'Carakan', 'JavaScriptCore' ]
};
var wrapped = DynamoDbDataTypes.AttributeValue.wrap(data);
JSON.stringify(wrapped, undefined, 2);
// {
// "name": {
// "S": "Java Script"
// },
// "age": {
// "N": "18"
// },
// "fav": {
// "M": {
// "food": {
// "SS": [
// "Rice",
// "Noodles"
// ]
// },
// "colors": {
// "SS": [
// "Orange",
// "Blue"
// ]
// }
// }
// },
// "engines": {
// "SS": [
// "Rhino",
// "v8",
// "SpiderMonkey",
// "Carakan",
// "JavaScriptCore"
// ]
// }
// }
This example shows how to use dynamodb-datatypes.js in the browser. To communicate with a live DynamoDB database, dont forget to include https://aws.amazon.com/sdk-for-browser/