将JSON转换为POJO [英] Convert JSON to POJO

查看:209
本文介绍了将JSON转换为POJO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jersey for REST WS,我将我的响应作为JSON。
我想将此响应转换为POJO。怎么做 ?
Thnx

I'm using Jersey for REST WS, and I get my response as JSON. I want to transform this response to a POJO. How to do it ? Thnx

推荐答案

要在Java和JSON之间进行转换,有许多API可供选择。

To convert between Java and JSON, there are a good number of APIs available to choose from.

您可以手动逐步执行JSON组件并提取值以填充Java对象,或者您可以使用JSON-to-Java绑定API来处理很多低 - 级别的映射问题。

You could "manually" step through the JSON components and extract values to populate Java objects, or you could use a JSON-to-Java binding API to take care of many low-level mapping concerns.

杰克逊是这样的API。它易于使用,可能提供最全面的API功能来解决常见问题和自定义。 StackOverflow.com有许多如何使用它的例子。

Jackson is such an API. It's easy to use and provides probably the fullest set of API features to address common issues and customizations. StackOverflow.com has many examples of how to use it.

这篇关于将JSON转换为POJO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆