DynamoDB includes a data type descriptor for each element in query response, as shown below:
"Item": {
"M" : {
"Age": {"N": "8"},
"Name": {"S": "Fido"},
"Vaccinations": {
"M": {
"Rabies": {
"L": [
{"S": "2009-03-17"},
{"S": "2011-09-21"},
{"S": "2014-07-08"}
]
},
"Distemper": {"S": "2015-10-13"}
}
}
}
}
I would like to strip all of these descriptors ("S", "L", "M", etc), so that it looks like the next example, before I JSON.stringify
the data.
"Item": {
"Age": "8",
"Name": "Fido",
"Vaccinations": {
"Rabies": [
"2009-03-17",
"2011-09-21",
"2014-07-08"
]
"Distemper": "2015-10-13"
}
}
Is there are standard (or recommended) method for doing this?
They have a converter that you can use.
For instance, here is their example:
var data= {"Item": {
"Age": {"N": "8"},
"Name": {"S": "Fido"},
"Vaccinations": {
"M": {
"Rabies": {
"L": [
{"S": "2009-03-17"},
{"S": "2011-09-21"},
{"S": "2014-07-08"}
]
},
"Distemper": {"S": "2015-10-13"}
}
}}};
var marshalled = AWS.DynamoDB.Converter.unmarshall(data);
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/Converter.html