第一种,直接转换对象实体(对象不包含对象的)
所用的包:
import ;
import ;
转换:
List<Tbempcdbdksqbr> sqbrList=new ArrayList<Tbempcdbdksqbr>();
if((json)) {
("JSON解析-2--");
JSONArray jsonAyyay2 = (json);
//JSONArray jsonAyyay = (jsonAyyay2).getJSONArray("dataList");
sqbrList = ((),);
}
第二种,对象里面包含对象的
A.对象集合
package ;
import ;
import ;
import ;
public class Statements {
private List<StatementsBsMediFee> bsMediFee;
private List<StatementsPreFeeValue> preFeeValue;
private List<StatementsSquareFund> squareFund;
private List<StatementsSquareInfo> squareInfo;
private List<StatementsDataFund> dataFund;
private List<StatementsFeeValue> feeValue;
private List<StatementsPreFee> preFee;
private List<StatementsSquareFee> squareFee;
public List<StatementsBsMediFee> getBsMediFee() {
return bsMediFee;
}
public void setBsMediFee(List<StatementsBsMediFee> bsMediFee) {
= bsMediFee;
}
public List<StatementsPreFeeValue> getPreFeeValue() {
return preFeeValue;
}
public void setPreFeeValue(List<StatementsPreFeeValue> preFeeValue) {
= preFeeValue;
}
public List<StatementsSquareFund> getSquareFund() {
return squareFund;
}
public void setSquareFund(List<StatementsSquareFund> squareFund) {
= squareFund;
}
public List<StatementsSquareInfo> getSquareInfo() {
return squareInfo;
}
public void setSquareInfo(List<StatementsSquareInfo> squareInfo) {
= squareInfo;
}
public List<StatementsDataFund> getDataFund() {
return dataFund;
}
public void setDataFund(List<StatementsDataFund> dataFund) {
= dataFund;
}
public List<StatementsFeeValue> getFeeValue() {
return feeValue;
}
public void setFeeValue(List<StatementsFeeValue> feeValue) {
= feeValue;
}
public List<StatementsPreFee> getPreFee() {
return preFee;
}
public void setPreFee(List<StatementsPreFee> preFee) {
= preFee;
}
public List<StatementsSquareFee> getSquareFee() {
return squareFee;
}
public void setSquareFee(List<StatementsSquareFee> squareFee) {
= squareFee;
}
}
B.转换:obj实体
@SuppressWarnings("unchecked")
public Statements getStatementService(Tbinsbjsdhis entity) {
List<Statements> list = new ArrayList<Statements>();
Statements obj = null;
WbxtCommonWSEntity wsEntity = (
"",
"createStateWSService", entity);
if (wsEntity != null) {
String json = ();
if((json)) {
JSONObject jobj = (json);
Map classMap = new HashMap();
("bsMediFee", );
("preFeeValue", );
("squareFund", );
("squareInfo", );
("dataFund", );
("feeValue", );
("preFee", );
("squareFee", );
obj=(Statements) (jobj, , classMap);
}
}
return obj;
}