JSONObject到Java的表示形式 [英] JSONObject to Java representation
本文介绍了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?
这篇关于JSONObject到Java的表示形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文