0

I hava a map of type Map<String, Object>. I am converting it into a JSONObject and then serializing to JSON inside a jackson custom serializer(for some reason). One of the values in the map is of type Date and when serializing to JSON that date field is being serialized as a string like: "Mon Jun ....". But I want the millisecond value of type long instead. How can I achieve that?

Claus
  • 150
  • 8
CSStudent
  • 309
  • 2
  • 12

1 Answers1

0

Create a custom Serializable class to override the Date class's default toString() method to convert the long millisecond value to string and return that as toString() output.

Ankit Kumar
  • 1,433
  • 1
  • 16
  • 24