'AWS Go sdk load unmarshal AttributeValue from JSON

I have exported a DynamoDB table to S3 using Dynamo JSON. Then I want to read this JSON from a Go program and using aws-sdk-go-v2 read the string from file and remove the Dynamo types.

For example, the export file looks like: {"Item":{"userId":{"S":"XXX"},"userEmail":{"S":"YYY"}}} and ideally I want to convert it to {"userId": "XXX" ,"userEmail":"YYY"}

The source structure can be more complex containing Maps so I would like to avoid manual parsing.

I am trying with attributevalue.(Un)Marshal but with no luck so far.

Any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source