Java Jackson

I am binding a JSON response to my class using Jackson. Everything works great except when there are more fields in my JSON response than my class defines. I want Jackson to ignore the fields that do not exist in my JSON response. This is due to compatability for future versions. If I add a new field I do not want previous versions of my client to crash. Ideas? ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally PromoResponse promoResponse = mapper.readValue(r, PromoResponse.class);

以上就是Java Jackson的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准