javajson.parse_JSON.parseObject的⼏种⽤法import com.alibaba.fastjson.JSONObject;
⼀.result格式:
{
"success":"true";
"returnAddress":"123"
}
JSONObject jsonObject=JSON.parseObject(result); //转换成object
⼆.result格式:
{
"success":"true";
"data":{
"shop_uid":"123";
};
}
JSONObject shop_user =JSON.parseObject(result);
JSON.parseObject(shop_user .getString("data")).getString("shop_uid")
三.result格式:
{
"success":"true";
"data":[{
"shop_uid":"123";
},
{
"shop_name":"张三"
}]
}
payload:{
t: [{
id: 3004463, creator: "luojian", gmtCreated: 1584683688000, modifier: "luojian",…
}],
count: 2}
/**把⼤的字符串转为json对象*/
JSONObject payload = JSONObject.ResultString()).getJSONObject("payload");
String count = String("count");
if(Integer.parseInt(count) > 0){
return JSONObject.String("t"),FullDiscountQueryDTO.class);//Json字符串数据转换成集合对象JSONArray detail = JSON.parseArray(result);
for (int i=0; i
(i)!=null||!(i).equals("")){
JSONArray detailChild =JSONArray(i);
Integer(1)>Integer.("shiptime").toString())){
ship.put("shiptime",Integer(1));fastjson怎么用
ship.put("desc",String(0));
}
}
}
JSON转javaBean
1.1 JSONobject=>javaBean
JSONObject contentChild = JSONObject(i);
QCCustomerScore.CustomerCore customerCore = JSON
.toJavaObject(contentChild, QCCustomerScore.CustomerCore.class);
1.2 String转javaBean
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论