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

ezile
  • 571
  • 2
  • 6
  • 20

1 Answers1

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.

ashawley
  • 4,195
  • 1
  • 27
  • 40