前端之家收集整理的这篇文章主要介绍了
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\",\"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());
}
原文链接:https://www.f2er.com/json/290225.html