JSONObject到Java的表示形式
问题描述:
我正在向服务器发送请求,并以以下格式检索JSON响应.如何将其转换为Java格式.预先感谢
I am sending a request to a server and retrieving a JSON response in the format below. How do I convert it to Java format. Thanks in advance
{"customers":{"788488":77,"280460":78},"errors":[]}
答
如果您想使用POJO类,请访问此网站:用于pojo的JSON模式
If you want to use POJO classes checkout this website : JSON schema to pojo
用法:选择源类型 JSON 和注释样式无
Usage : Select source type JSON , and annotation style None
您也可以在我的答案中查找有关使用Gson
将json响应转换为POJO的信息,在此选项中,选择注释样式 Gson :
Also you can look my answer for information about converting json response to POJO with Gson
, in this option select annotation style Gson : Convert JSON to POJO with Gson
更多信息:如何创建POJO?