alibaba FastJson 解析

public static void main(String[] args) {
	  String jsonStr = "{\"financeChannel\":\"CFCAICBC_FBC01FB02FSS0404\",\"fundChannel\":\"CFCA\",\"payChannel\":\"ICBC04\"}";
	  FbiChannelMapping fbiChannelMapping = (FbiChannelMapping) JSON.parseObject(jsonStr, FbiChannelMapping.class); 
	  System.out.println(fbiChannelMapping.getPayChannel());
	  
	  
	  String jsonStrArray = "[{\"financeChannel\":\"CFCAICBC_FBC01FB02FSS0404\",\"fundChannel\":\"CFCA\",\"payChannel\":\"ICBC04\"}]";
 
  
  
    JSONArray array = JSONArray.parseArray(jsonStrArray);
		JSONObject jobj = (JSONObject)array.get(0);
		FbiChannelMapping fbiChannelMapping2 = JSON.toJavaObject(jobj,FbiChannelMapping.class);
		System.out.println(fbiChannelMapping2.getPayChannel());
		 
  }

你可能感兴趣的:(alibaba FastJson 解析)