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?
Asked
Active
Viewed 136 times
0
-
Cant you call date.getTime () in your custom serializer? – Guy Bouallet Feb 19 '14 at 18:49
-
1See [this question](http://stackoverflow.com/q/3269459/642706) and answers about using a Jackson serializer for [Joda-Time](http://www.joda.org/joda-time/). – Basil Bourque Feb 20 '14 at 08:16
1 Answers
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