JSONObject转实体
时间: 2023-09-26 09:14:11 浏览: 113
可以使用net.sf.json.JSONObject和com.alibaba.fastjson.JSONObject来将JSONObject转换为实体对象。如果使用net.sf.json.JSONObject,可以使用以下方法来实现JSONObject转实体的操作: Student bean = (Student) JSONObject.toBean(JSONObject.fromObject(jsonObject), Student.class)。其中,jsonObject是待转换的JSONObject对象,Student.class是目标实体的类。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [关于JSONObject转实体和普通方法(通用)转实体](https://blog.csdn.net/JavaWHD/article/details/118326264)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [JSONObject.toBean() 把jsonobject转换成实体类](https://blog.csdn.net/LC_Liangchao/article/details/121793583)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文