mercredi 1 avril 2015

Changing default json for an object in Spring Boot Application



  • I have a simple Spring Boot Application having a simple MyDateTime model class only having a java.util.Date instance variable with private access, getters/setters and default constructor.




  • A controller just instantiates this object and returns back.




  • In the output, I see that default representation of Date object is done as an Integer (maybe millis from Epoch)




  • Is there any way I can change the default jsonification of Date Object into ISO-String or any other String?




EDIT:


Some Clarification:


I'm very new to Spring and Spring Boot. I'm using the template from a sample application on spring's website. JSONification is done through Jackson. Rest, I don't know much about Spring in general.


Aucun commentaire:

Enregistrer un commentaire