java c json时间转换_java – 尝试在json中解析日期/时间时出现c...

我正在使用RestTemplete从rest api获取json数据,而我正在使用Gson将数据从json格式解析为Object

Gson gson = new Gson();

restTemplate = new RestTemplate();

restTemplate.getMessageConverters().add(new GsonHttpMessageConverter());

restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

List resultList = null;

resultList = Arrays.asList(restTemplate.getForObject(urlService, Appel[].class));

但是我用Date来解决这个问题,我该怎么办..

Could not read JSON: 1382828400000; nested exception is com.google.gson.JsonSyntaxException: 1382828400000

我的Pojo包含其他pojos的身体

public class Appel implements Serializable {

private Integer numOrdre;

private String reference;

private String objet;

private String organisme;

private Double budget;

private Double caution;

private Date dateParution;

private Date heureParution;

private Date dateLimite;

private Date heureLimite;

private List supportList;

private Ville villeid;

private Categorie categorieid;

public Appel() {

}

public Appel(Integer numOrdre, String reference, String objet, String organisme, Date dateParution, Date heureParution, Date dateLimite) {

this.numOrdre = numOrdre;

this.reference = reference;

this.objet = objet;

this.organisme = organisme;

this.dateParution = dateParution;

this.heureParution = heureParution;

this.dateLimite = dateLimite;

}

这是我的API返回的json

[

{

"numOrdre": 918272,

"reference": "some text",

"objet": "some text",

"organisme": "some text",

"budget": 3000000,

"caution": 3000000,

"dateParution": 1382828400000,

"heureParution": 59400000,

"dateLimite": 1389657600000,

"heureLimite": 34200000,

"supportList":

[

{

"id": 1,

"nom": "some text",

"dateSupport": 1384732800000,

"pgCol": "013/01"

},

{

"id": 2,

"nom": "some text",

"dateSupport": 1380236400000,

"pgCol": "011/01"

}

],

"villeid":

{

"id": 2,

"nom": "Ville",

"paysid":

{

"id": 1,

"nom": "Pays"

}

},

"categorieid":

{

"id": 1,

"description": "some text"

}

},

.....

]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值