hendry hendry -4 years ago 188
JSON Question

Unmarshall DynamoDB JSON

Given some DynamoDB JSON via a DynamoDB NewImage stream event, how do I unmarshall it to regular JSON?


Normally I would use AWS.DynamoDB.DocumentClient, however I can't seem to find a generic Marshall/Unmarshall function.

Sidenote: Do I lose anything unmarshalling DynamoDB JSON to JSON and back again?

Answer Source

You can use the AWS.DynamoDB.Converter.output function. Calling the following will return { updated_at: 146548182, uuid: 'foo', status: 'new' }:

    M: {

Everything that can be modeled in DynamoDB's marshalled JSON format can be safely translated to and from JS objects.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download