0

由于数据模型发生了变化,我重构了一个 rest 微服务。但是我们希望保留 json 有效负载(基于旧数据模型的服务),因为该有效负载正被多个其他服务使用。

请建议我用 POJO 字段映射 json 对象的好方法?

4

2 回答 2

1
public class Data {
    String new;

    @JsonProperty("new")
    public String getNew() {
      return new;
    }

    @JsonProperty("old")
    public void setNew(String old) {
      this.new = old;
    }
}
于 2017-02-23T14:31:53.077 回答
0

你试过使用@JsonProperty 吗?如果您使用的是杰克逊。

于 2017-02-23T14:23:42.073 回答