Java Spring Jackons Date serialization

后端 未结 4 1129
野的像风
野的像风 2021-01-13 00:20

I\'m using Spring MVC and Jackson for JSON de/serialization. But im facing a problem with serializing a date.

By default Jackson serialize a date as an epoch. But i

4条回答
  •  离开以前
    2021-01-13 00:44

    I've fixed my problem. So for reference to others with a similar problem.

    I've deleted the following elements in the spring context config xml:

    
    

    and

    
    
    
    
        
            yyyy-MM-dd'T'HH:mm:ss.SSSZ
        
    
    

    Then I added the following:

    
        
    
    

    and changed the following:

    
    
    
    
        
            WRITE_DATES_AS_TIMESTAMPS
        
    
    

    in

    
    
    
    
        
            WRITE_DATES_AS_TIMESTAMPS
        
    
    

    After this Spring was able to serialize my date into json as a ISO date.

提交回复
热议问题