java - Date from Spring to web as timestamp using Jakson -
i have match
class , field date start
. goal start timestamp. use spring, angularjs, , jackson json converter.
spring controller:
@requestmapping(value = "/web2/getmatch", method =requestmethod.post) public @responsebody match getpickshistory() { pickdao pd = new pickdao(); return pd.getmatch(); }
on agularjs controler:
var res = $http.post(urlser.url+"web2/getmatch"); res.success(function(data, status, headers, config) { // returns data.start = "aug 8, 2015 7:00:00 pm" // goal timestamp });
i assume 'timestamp' mean numeric timestamp opposed textual representation. can use custom objectmapper
:
@component @primary public class customobjectmapper extends objectmapper { public customobjectmapper() { configure(serializationfeature.write_dates_as_timestamps, true); } }
Comments
Post a Comment