1

We have an upstream client using "Dynamo ->Lambda -> SNS -> SQS" architecture to publish data. We, as a sqs consumer, need to process the message. The SQS message is in the raw dynamo record format like below

{"key1": {"m":{"key2":{"s":"val2"},"key3":{"s":"val3"}}}}

I want to convert the dynamo json to normal json so that I can use json de-serializer to get a POJO. I saw similar questions on SO but they start either with a DynamoDbRecord or Map<String, Attribute> to get normal JSON. I only have the string in SQS message. I found the Javascript SDK but nothing similar in JAVA.

Are there simple built in ways to do this or would I need to parse the string using "S", "N" etc. to get normal json?

Thanks

2
  • which libray are you using for json processing? Commented Jul 30, 2020 at 6:09
  • I have tried Jackson ObjectMapper and Gson. Commented Jul 30, 2020 at 11:37

1 Answer 1

0

There is the same DynamoDB document Item in the Java SDK that can take a string:

import com.amazonaws.services.dynamodbv2.document.Item;

Item item = Item.fromJSON(json);

Presumably, it uses Jackson underneath the covers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.