public class JsonTest {
public static void main(String[] args){
String ss = "{\"headTrCode\":\"030500D600\",\"headUserId\":\"batch_user_id\",\"headCustNo\":\"batch_cust_no\",\"headReqNo\":\"844696e2cf244cae969697f62270a8ca\",\"headSerialNo\":\"201705150000006949\",\"headTenantId\":\"004\",\"headOrgNo\":\"batch_org_no\",\"headTrDate\":\"20170515\",\"headReqTrDate\":\"20170704\",\"headTrTime\":\"162019\",\"headChannel\":\"06\",\"language\":\"ZH\",\"respcode\":\"0TB320000005\",\"respmsg\":\"请求参数校验失败[对账日期不能为空]\",\"responseType\":\"FAIL\",\"respJnl\":\"FAIL\"}";
TbspResponse response = new Gson().fromJson(ss,TbspResponse.class);
System.out.println(response.getHeadChannel());
String tt = new Gson().toJson(response);
System.out.println(tt);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonParser parser = new JsonParser();
JsonElement je = parser.parse(tt.toString());
String result = gson.toJson(je);
TbspResponse response2 = new Gson().fromJson(ss,TbspResponse.class);
System.out.println(response.getHeadChannel());
}
}