{
"application_num" : 185,
"age" : 35,
"mobile_num" : "9943847180",
"active" : null,
"photo" : null,
"bytes" : null,
"creator" : null,
"modifier" : null,
"modifiedby" : null,
"updatedby" : null,
"cus_first_name" : "firstname",
"cus_last_name" : "lastname",
"sex" : "Male",
"profession" : "profession",
"designation" : "designation",
"work_place_address" : "workkkkkkkkkk",
"phone_number" : "044222222222",
"resi_address" : "resssssssssssssi",
"membership_type" : "Silver",
"debitbal" : "100022",
"dueamt" : "1002",
"renewaldate" : "2013-06-13",
"photoinputstream" : null
}
this is my json string.I stored in String myjsonString
, Approbvall_BE
is my class. This is my code.
Gson gson=new Gson();
//convert the json string back to object
Approval_BE app_be = gson.fromJson(myjsonString, Approval_BE.class);
System.out.println("print"+app_be.cus_first_name);
after this line even sop itself not working. Can anyone help me?.
Approval_BE app_be = gson.fromJson(myjsonString, Approval_BE.class);
使用jsonschema2pojo生成JSON模型,并使用相同的代码将其反序列化为Java对象
String str = "Your json string";
JSONObject json =新的JSONObject(str);
import org.codehaus.jackson.map.ObjectMapper;
pass json in readvalue method
User user = new ObjectMapper().readValue(json, User.class);
this will conver json to java
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.