Skip to content

How to consume DynamoDB JSON and get map[string]types.AttributeValue using json.Unmarshal? #1652

Answered by Luke-Davies
marc-ostrow asked this question in Q&A
Discussion options

You must be logged in to vote

tl;dr: A solution is provided in the last paragraph.

I have the same use case as @marc-ostrow and @jspri of a lambda triggered by a dynamodb stream which then needs to interact with the sdk. I want to be able to use the NewImage/OldImage of the event for another PutItem call and I also want the attributevalue.UnmarshalMap convenience that the SDK provides.

I was trying to use ("github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types").Record in the event struct I defined but this has two issues - the first being the one highlighted by OP and the second being an issue that is present in the v1 SDK: ApproximateCreationDateTime cannot be unmarshalled into *time.Time because the value is u…

Replies: 12 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RanVaknin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tomvictor
Comment options

Comment options

You must be logged in to vote
6 replies
@blixt
Comment options

@blixt
Comment options

@blixt
Comment options

@t0mpl
Comment options

@jufemaiz
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information.
Converted from issue

This discussion was converted from issue #1124 on April 01, 2022 17:34.