After struggling with the AWS JS SDK V3 documentation and examples, I decided to share my findings to help others. The official SDK docs were frustrating and misleading, especially when it came to showing marshaled output properly. While the DDB Doc client can remove object types from the response, they don't explain how to do it clearly. In my answer below, you'll find a solution for getting a clean, marshaled response.
Here's an example of an unmarshalled response, where you see S
indicating string as the value type:
[
{
project_name: { S: 'fake project' },
service_now_request_id: { S: 'CHG000212312' },
service_now_request_url: {
S: 'https://service-now.com/sampleApp?id=snx&spa=1&m=changes&r=0d12121aa442f33c8e0ebb3555'
}
}
]
If you'd like a cleaner response format like the one shown below, using the full DDB document client is recommended:
[
{
project_name: 'fake project',
service_now_request_id: 'CHG000212312',
service_now_request_url: 'https://service-now.com/sampleApp?id=snx&spa=1&m=changes&r=0d12121aa442f33c8e0ebb3555',
}
]