I am subscribing to an SQS and the message body has a few epoch times. It looks like below
"createdAt" : 1660744139,\n "updatedAt" : 1660744139,\n
I have a Java POJO which contains 2 fields
Date createdAt;
Date updatedAt;
I am using GSON to deserialize the SQS message body to my POJO, but it's failing with an error com.google.gson.JsonSyntaxException: 1660744139
.
My JSON instantiation looks like
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
If I understand it right, the error is being thrown because I am trying to deserialize a Long type to Date. What will be the correct way to deserialize?
I have seen suggestions to instantiate my GSON object with dateFormatter, but not sure if that will work for my case. Thank you.