什么是fastjson

fastjson是阿里巴巴的开源JSON解析库,它可以解析JSON格式的字符串,支持将Java Bean序列化为JSON字符串,也可以从JSON字符串反序列化到JavaBean

fastjson配置Maven依赖

<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.79</version>
</dependency>

方法类转换图如下:

对象关系:
#mermaid-svg-9D8lbphTqD9foehN {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-9D8lbphTqD9foehN .error-icon{fill:#552222;}#mermaid-svg-9D8lbphTqD9foehN .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-9D8lbphTqD9foehN .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-9D8lbphTqD9foehN .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-9D8lbphTqD9foehN .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-9D8lbphTqD9foehN .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-9D8lbphTqD9foehN .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-9D8lbphTqD9foehN .marker{fill:#333333;stroke:#333333;}#mermaid-svg-9D8lbphTqD9foehN .marker.cross{stroke:#333333;}#mermaid-svg-9D8lbphTqD9foehN svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-9D8lbphTqD9foehN .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-9D8lbphTqD9foehN .cluster-label text{fill:#333;}#mermaid-svg-9D8lbphTqD9foehN .cluster-label span{color:#333;}#mermaid-svg-9D8lbphTqD9foehN .label text,#mermaid-svg-9D8lbphTqD9foehN span{fill:#333;color:#333;}#mermaid-svg-9D8lbphTqD9foehN .node rect,#mermaid-svg-9D8lbphTqD9foehN .node circle,#mermaid-svg-9D8lbphTqD9foehN .node ellipse,#mermaid-svg-9D8lbphTqD9foehN .node polygon,#mermaid-svg-9D8lbphTqD9foehN .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-9D8lbphTqD9foehN .node .label{text-align:center;}#mermaid-svg-9D8lbphTqD9foehN .node.clickable{cursor:pointer;}#mermaid-svg-9D8lbphTqD9foehN .arrowheadPath{fill:#333333;}#mermaid-svg-9D8lbphTqD9foehN .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-9D8lbphTqD9foehN .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-9D8lbphTqD9foehN .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-9D8lbphTqD9foehN .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-9D8lbphTqD9foehN .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-9D8lbphTqD9foehN .cluster text{fill:#333;}#mermaid-svg-9D8lbphTqD9foehN .cluster span{color:#333;}#mermaid-svg-9D8lbphTqD9foehN div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-9D8lbphTqD9foehN :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

JSON.toJSONString(Object javaObject)
JSON.toJavaObject(JSON json,Class clazz)
JSON.parseObject(String text)
JSON.parseObject(String text,Class clazz)
JSON.toJSONString(Object javaObject)
(JSONObject)JSON.toJSON(Object javaObject)
JSON对象
JSON字符串
Java对象
数组集合关系:
#mermaid-svg-86BDmGook0fS5Zmj {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-86BDmGook0fS5Zmj .error-icon{fill:#552222;}#mermaid-svg-86BDmGook0fS5Zmj .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-86BDmGook0fS5Zmj .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-86BDmGook0fS5Zmj .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-86BDmGook0fS5Zmj .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-86BDmGook0fS5Zmj .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-86BDmGook0fS5Zmj .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-86BDmGook0fS5Zmj .marker{fill:#333333;stroke:#333333;}#mermaid-svg-86BDmGook0fS5Zmj .marker.cross{stroke:#333333;}#mermaid-svg-86BDmGook0fS5Zmj svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-86BDmGook0fS5Zmj .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-86BDmGook0fS5Zmj .cluster-label text{fill:#333;}#mermaid-svg-86BDmGook0fS5Zmj .cluster-label span{color:#333;}#mermaid-svg-86BDmGook0fS5Zmj .label text,#mermaid-svg-86BDmGook0fS5Zmj span{fill:#333;color:#333;}#mermaid-svg-86BDmGook0fS5Zmj .node rect,#mermaid-svg-86BDmGook0fS5Zmj .node circle,#mermaid-svg-86BDmGook0fS5Zmj .node ellipse,#mermaid-svg-86BDmGook0fS5Zmj .node polygon,#mermaid-svg-86BDmGook0fS5Zmj .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-86BDmGook0fS5Zmj .node .label{text-align:center;}#mermaid-svg-86BDmGook0fS5Zmj .node.clickable{cursor:pointer;}#mermaid-svg-86BDmGook0fS5Zmj .arrowheadPath{fill:#333333;}#mermaid-svg-86BDmGook0fS5Zmj .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-86BDmGook0fS5Zmj .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-86BDmGook0fS5Zmj .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-86BDmGook0fS5Zmj .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-86BDmGook0fS5Zmj .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-86BDmGook0fS5Zmj .cluster text{fill:#333;}#mermaid-svg-86BDmGook0fS5Zmj .cluster span{color:#333;}#mermaid-svg-86BDmGook0fS5Zmj div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-86BDmGook0fS5Zmj :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

JSON.toJSONString(Object object)
不能直接转:先转字符串再转集合
JSON.parseArray(String text)
JSON.parseArray(String text,Class clazz)
JSON.toJSONString(Object object)
(JSONArray)JSON.toJSON(Object javaObject)
JSON数组
JSON字符串
Java集合
总图:
#mermaid-svg-D30bpmSHxCryWP34 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-D30bpmSHxCryWP34 .error-icon{fill:#552222;}#mermaid-svg-D30bpmSHxCryWP34 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-D30bpmSHxCryWP34 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-D30bpmSHxCryWP34 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-D30bpmSHxCryWP34 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-D30bpmSHxCryWP34 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-D30bpmSHxCryWP34 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-D30bpmSHxCryWP34 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-D30bpmSHxCryWP34 .marker.cross{stroke:#333333;}#mermaid-svg-D30bpmSHxCryWP34 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-D30bpmSHxCryWP34 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-D30bpmSHxCryWP34 .cluster-label text{fill:#333;}#mermaid-svg-D30bpmSHxCryWP34 .cluster-label span{color:#333;}#mermaid-svg-D30bpmSHxCryWP34 .label text,#mermaid-svg-D30bpmSHxCryWP34 span{fill:#333;color:#333;}#mermaid-svg-D30bpmSHxCryWP34 .node rect,#mermaid-svg-D30bpmSHxCryWP34 .node circle,#mermaid-svg-D30bpmSHxCryWP34 .node ellipse,#mermaid-svg-D30bpmSHxCryWP34 .node polygon,#mermaid-svg-D30bpmSHxCryWP34 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-D30bpmSHxCryWP34 .node .label{text-align:center;}#mermaid-svg-D30bpmSHxCryWP34 .node.clickable{cursor:pointer;}#mermaid-svg-D30bpmSHxCryWP34 .arrowheadPath{fill:#333333;}#mermaid-svg-D30bpmSHxCryWP34 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-D30bpmSHxCryWP34 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-D30bpmSHxCryWP34 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-D30bpmSHxCryWP34 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-D30bpmSHxCryWP34 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-D30bpmSHxCryWP34 .cluster text{fill:#333;}#mermaid-svg-D30bpmSHxCryWP34 .cluster span{color:#333;}#mermaid-svg-D30bpmSHxCryWP34 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-D30bpmSHxCryWP34 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

JSON.toJSONString(Object object)
间接转:数组->字符串->集合
对象:JSON.parseObject(String text,Class clazz)
集合:JSON.parseArray(String text,Class clazz)
对象:JSON.parseObject(String text)
数组:JSON.parseArray(String text)
JSON.toJSONString(Object object)
对象:(JSONObject)JSON.toJSON(Object javaObject)
集合:(JSONArray)JSON.toJSON(Object javaObject)
JSON对象(数组)
JSON字符串
Java对象(集合)

中国外汇交易中心源码为例:

解析其源码可知,其中https://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/ccpr.json为承载数据的json页
添加HttpClient获取其网页源码:
数据采集所需依赖有:

<dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.6</version>
</dependency>

先创建几个实体类(实体类的变量名应与解析的JSON字符串中变量名相同):

创建实体类Page.java:

public class Page {private String head;private String data;private String records;public String getHead() {return head;}public void setHead(String head) {this.head = head;}public String getData() {return data;}public void setData(String data) {this.data = data;}public String getRecords() {return records;}public void setRecords(String records) {this.records = records;}
}

创建实体类Head.java:

public class Head {private String version;private String provider;private String req_code;private String rep_code;private String rep_message;private String ts;private String producer;public String getVersion() {return version;}public void setVersion(String version) {this.version = version;}public String getProvider() {return provider;}public void setProvider(String provider) {this.provider = provider;}public String getReq_code() {return req_code;}public void setReq_code(String req_code) {this.req_code = req_code;}public String getRep_code() {return rep_code;}public void setRep_code(String rep_code) {this.rep_code = rep_code;}public String getRep_message() {return rep_message;}public void setRep_message(String rep_message) {this.rep_message = rep_message;}public String getTs() {return ts;}public void setTs(String ts) {this.ts = ts;}public String getProducer() {return producer;}public void setProducer(String producer) {this.producer = producer;}
}

创建实体类Record.java:

public class Record {private String vrtCode;private String price;private String bp;private String vrtName;private String vrtEName;private String foreignCName;private String bpDouble;private String approvedTime;private String approvedTimeEn;private String showDate;private String showDateForCn;private String lastMonthAvgPrice;private String monthPrice;private String quarterPrice;private String yearPrice;private String isShowBp;private String show;private String url;private String bannerPic;private String bannerCss;public String getVrtCode() {return vrtCode;}public void setVrtCode(String vrtCode) {this.vrtCode = vrtCode;}public String getPrice() {return price;}public void setPrice(String price) {this.price = price;}public String getBp() {return bp;}public void setBp(String bp) {this.bp = bp;}public String getVrtName() {return vrtName;}public void setVrtName(String vrtName) {this.vrtName = vrtName;}public String getVrtEName() {return vrtEName;}public void setVrtEName(String vrtEName) {this.vrtEName = vrtEName;}public String getForeignCName() {return foreignCName;}public void setForeignCName(String foreignCName) {this.foreignCName = foreignCName;}public String getBpDouble() {return bpDouble;}public void setBpDouble(String bpDouble) {this.bpDouble = bpDouble;}public String getApprovedTime() {return approvedTime;}public void setApprovedTime(String approvedTime) {this.approvedTime = approvedTime;}public String getApprovedTimeEn() {return approvedTimeEn;}public void setApprovedTimeEn(String approvedTimeEn) {this.approvedTimeEn = approvedTimeEn;}public String getShowDate() {return showDate;}public void setShowDate(String showDate) {this.showDate = showDate;}public String getShowDateForCn() {return showDateForCn;}public void setShowDateForCn(String showDateForCn) {this.showDateForCn = showDateForCn;}public String getLastMonthAvgPrice() {return lastMonthAvgPrice;}public void setLastMonthAvgPrice(String lastMonthAvgPrice) {this.lastMonthAvgPrice = lastMonthAvgPrice;}public String getMonthPrice() {return monthPrice;}public void setMonthPrice(String monthPrice) {this.monthPrice = monthPrice;}public String getQuarterPrice() {return quarterPrice;}public void setQuarterPrice(String quarterPrice) {this.quarterPrice = quarterPrice;}public String getYearPrice() {return yearPrice;}public void setYearPrice(String yearPrice) {this.yearPrice = yearPrice;}public String getIsShowBp() {return isShowBp;}public void setIsShowBp(String isShowBp) {this.isShowBp = isShowBp;}public String getShow() {return show;}public void setShow(String show) {this.show = show;}public String getUrl() {return url;}public void setUrl(String url) {this.url = url;}public String getBannerPic() {return bannerPic;}public void setBannerPic(String bannerPic) {this.bannerPic = bannerPic;}public String getBannerCss() {return bannerCss;}public void setBannerCss(String bannerCss) {this.bannerCss = bannerCss;}
}

中国外汇交易中心获取json中的数据程序,如下:

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;import java.util.ArrayList;
import java.util.List;public class Main {public static void main(String[] args) {String text="";try{/* 以GET方法获取中国外汇交易中心网页的json数据 */CloseableHttpClient httpClient=new DefaultHttpClient();HttpGet httpGet=new HttpGet("http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/ccpr.json");HttpResponse response=httpClient.execute(httpGet);HttpEntity entity= response.getEntity();if(entity!=null){text= EntityUtils.toString(entity,"UTF-8");EntityUtils.consume(entity);}/* 调用fastjson解析JSON字符串 *///  JSON字符串-->JSON对象JSONObject jsonObject= JSON.parseObject(text);Page page=JSON.toJavaObject(jsonObject,Page.class);System.out.println("Page.Head="+page.getHead());System.out.println("Page.Data="+page.getData());System.out.println("Page.Records="+page.getRecords());//  JSON对象-->JSON数组-->JSON字符串-->Java集合JSONArray jsonArray=jsonObject.getJSONArray("records");List<Record> records=new ArrayList<>();for(int i=0;i<jsonArray.size();i++){Record record=JSON.parseObject(jsonArray.getString(i),Record.class);records.add(record);}for(Record record:records){System.out.println("record记录有:");System.out.println("vrtCode="+record.getVrtCode());System.out.println("price="+record.getPrice());System.out.println("bp="+record.getBp());System.out.println("vrtName="+record.getVrtName());System.out.println("vrtEName="+record.getVrtEName());System.out.println("foreignCName="+record.getForeignCName());System.out.println("bpDouble="+record.getBpDouble());System.out.println("approvedTime="+record.getApprovedTime());System.out.println("approvedTimeEn="+record.getApprovedTimeEn());System.out.println("showDate="+record.getShowDate());System.out.println("showDateForCn="+record.getShowDateForCn());System.out.println("lastMonthAvgPrice="+record.getLastMonthAvgPrice());System.out.println("monthPrice="+record.getMonthPrice());System.out.println("quarterPrice="+record.getQuarterPrice());System.out.println("yearPrice="+record.getYearPrice());System.out.println("isShowBp="+record.getIsShowBp());System.out.println("show="+record.getShow());System.out.println("url="+record.getUrl());System.out.println("bannerPic="+record.getBannerPic());System.out.println("bannerCss="+record.getBannerCss());System.out.println();}//  JSON字符串-->JSON对象--->JSON字符串--->Java对象String headtext=jsonObject.getString("head");Head head=JSON.parseObject(headtext,Head.class);System.out.println("Head.Version="+head.getVersion());System.out.println("Head.provider="+head.getProvider());System.out.println("Head.req_code="+head.getReq_code());System.out.println("Head.rep_code="+head.getRep_code());System.out.println("Head.rep_message="+head.getRep_message());System.out.println("Head.ts="+head.getTs());System.out.println("Head.producer="+head.getProducer());}catch (Exception e){e.printStackTrace();}}
}
注:为防止原网站升级迁移,故附源码于文后:

网页json源码:

{"head":{"version":"2.0","provider":"CWAP","req_code":"","rep_code":"200","rep_message":"","ts":1648430740382,"producer":""},"data":{"lastDateEn":"28/03/2022 9:15","lastDate":"2022-03-28 9:15","pairChange":"美元/人民币欧元/人民币100日元/人民币港元/人民币英镑/人民币澳元/人民币新西兰元/人民币新加坡元/人民币瑞士法郎/人民币加元/人民币人民币/马来西亚林吉特人民币/俄罗斯卢布人民币/南非兰特人民币/韩元人民币/阿联酋迪拉姆人民币/沙特里亚尔人民币/匈牙利福林人民币/波兰兹罗提人民币/丹麦克朗人民币/瑞典克朗人民币/挪威克朗人民币/土耳其里拉人民币/墨西哥比索人民币/泰铢"},"records":[{"vrtCode":"1","price":"6.3732","bp":"7.00","vrtName":"美元/人民币","vrtEName":"USD/CNY","foreignCName":"USD","bpDouble":-7.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/flag_usd.gif","bannerCss":""},{"vrtCode":"2","price":"6.9993","bp":"162.00","vrtName":"欧元/人民币","vrtEName":"EUR/CNY","foreignCName":"EUR","bpDouble":-162.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152157516.jpg","bannerCss":""},{"vrtCode":"3","price":"5.2138","bp":"34.00","vrtName":"100日元/人民币","vrtEName":"100JPY/CNY","foreignCName":"JPY","bpDouble":34.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152213196.jpg","bannerCss":""},{"vrtCode":"4","price":"0.81407","bp":"6.50","vrtName":"港元/人民币","vrtEName":"HKD/CNY","foreignCName":"HKD","bpDouble":-6.5,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912151836268.jpg","bannerCss":""},{"vrtCode":"5","price":"8.3942","bp":"161.00","vrtName":"英镑/人民币","vrtEName":"GBP/CNY","foreignCName":"GBP","bpDouble":-161.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152141840.jpg","bannerCss":""},{"vrtCode":"6","price":"4.7912","bp":"36.00","vrtName":"澳元/人民币","vrtEName":"AUD/CNY","foreignCName":"AUD","bpDouble":36.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912151915601.jpg","bannerCss":""},{"vrtCode":"7","price":"4.4342","bp":"25.00","vrtName":"新西兰元/人民币","vrtEName":"NZD/CNY","foreignCName":"NZD","bpDouble":-25.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912151950699.jpg","bannerCss":""},{"vrtCode":"8","price":"4.6911","bp":"34.00","vrtName":"新加坡元/人民币","vrtEName":"SGD/CNY","foreignCName":"SGD","bpDouble":-34.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152004500.jpg","bannerCss":""},{"vrtCode":"12","price":"6.8446","bp":"144.00","vrtName":"瑞士法郎/人民币","vrtEName":"CHF/CNY","foreignCName":"CHF","bpDouble":-144.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152058150.jpg","bannerCss":""},{"vrtCode":"9","price":"5.1059","bp":"174.00","vrtName":"加元/人民币","vrtEName":"CAD/CNY","foreignCName":"CAD","bpDouble":174.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152019513.jpg","bannerCss":""},{"vrtCode":"10","price":"0.66052","bp":"23.80","vrtName":"人民币/马来西亚林吉特","vrtEName":"CNY/MYR","foreignCName":"MYR","bpDouble":-23.8,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152030828.jpg","bannerCss":""},{"vrtCode":"11","price":"15.7002","bp":"3332.00","vrtName":"人民币/俄罗斯卢布","vrtEName":"CNY/RUB","foreignCName":"RUB","bpDouble":-3332.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152045202.jpg","bannerCss":""},{"vrtCode":"41","price":"2.2839","bp":"60.00","vrtName":"人民币/南非兰特","vrtEName":"CNY/ZAR","foreignCName":"ZAR","bpDouble":60.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152118608.jpg","bannerCss":""},{"vrtCode":"42","price":"191.87","bp":"49.00","vrtName":"人民币/韩元","vrtEName":"CNY/KRW","foreignCName":"KRW","bpDouble":49.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160912152133696.jpg","bannerCss":""},{"vrtCode":"61","price":"0.57617","bp":"0.40","vrtName":"人民币/阿联酋迪拉姆","vrtEName":"CNY/AED","foreignCName":"AED","bpDouble":-0.4,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160923172345816.jpg","bannerCss":""},{"vrtCode":"62","price":"0.58844","bp":"0.40","vrtName":"人民币/沙特里亚尔","vrtEName":"CNY/SAR","foreignCName":"SAR","bpDouble":-0.4,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20160923172544634.jpg","bannerCss":""},{"vrtCode":"63","price":"53.2125","bp":"2547.00","vrtName":"人民币/匈牙利福林","vrtEName":"CNY/HUF","foreignCName":"HUF","bpDouble":-2547.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209185627409.jpg","bannerCss":""},{"vrtCode":"64","price":"0.66953","bp":"103.70","vrtName":"人民币/波兰兹罗提","vrtEName":"CNY/PLN","foreignCName":"PLN","bpDouble":-103.7,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209185813438.jpg","bannerCss":""},{"vrtCode":"65","price":"1.0627","bp":"22.00","vrtName":"人民币/丹麦克朗","vrtEName":"CNY/DKK","foreignCName":"DKK","bpDouble":22.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209185905504.jpg","bannerCss":""},{"vrtCode":"66","price":"1.4776","bp":"23.00","vrtName":"人民币/瑞典克朗","vrtEName":"CNY/SEK","foreignCName":"SEK","bpDouble":23.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209190017458.jpg","bannerCss":""},{"vrtCode":"67","price":"1.3532","bp":"60.00","vrtName":"人民币/挪威克朗","vrtEName":"CNY/NOK","foreignCName":"NOK","bpDouble":-60.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209190108743.jpg","bannerCss":""},{"vrtCode":"68","price":"2.32748","bp":"15.80","vrtName":"人民币/土耳其里拉","vrtEName":"CNY/TRY","foreignCName":"TRY","bpDouble":15.8,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209190206460.jpg","bannerCss":""},{"vrtCode":"69","price":"3.1430","bp":"80.00","vrtName":"人民币/墨西哥比索","vrtEName":"CNY/MXN","foreignCName":"MXN","bpDouble":-80.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20161209190255587.jpg","bannerCss":""},{"vrtCode":"13","price":"5.2740","bp":"127.00","vrtName":"人民币/泰铢","vrtEName":"CNY/THB","foreignCName":"THB","bpDouble":127.0,"approvedTime":"","approvedTimeEn":"","showDate":"","showDateForCn":"","lastMonthAvgPrice":"---","monthPrice":"---","quarterPrice":"---","yearPrice":"---","isShowBp":true,"show":true,"url":"","bannerPic":"/r/cms/www/chinamoney/assets/images/flag/20180203155245539.jpg","bannerCss":""}]}

Java网络爬虫以fastjson提取JSON数据相关推荐

  1. Java网络爬虫--一步步使用Java网络爬虫技术实现豆瓣读书Top250数据的爬取,并插入数据库

    一步步使用Java网络爬虫技术实现豆瓣读书Top250数据的爬取,并插入数据库 目录 一步步使用Java网络爬虫技术实现豆瓣读书Top250数据的爬取,并插入数据库 第一步:创建项目,搭建项目结构 p ...

  2. Java网络爬虫该如何学习

    文章目录 引言 怎么入门网络爬虫 课程特色 学完本课程能收获什么 引言 互联网以及移动技术的飞速发展,使得全球数据量呈现前所未有的爆炸式增长态势.例如,用户在互联网上的搜索数据.交易数据.评论数据.社 ...

  3. java 网络爬虫 正则表达式_【干货】Java网络爬虫基础知识

    原标题:[干货]Java网络爬虫基础知识 引言 Java 网络爬虫具有很好的扩展性可伸缩性,其是目前搜索引擎开发的重要组成部分.例如,著名的网络爬虫工具 Nutch 便是采用 Java 开发,该工具以 ...

  4. fastjson解析JSON数据乱序导致的问题

    本文作者:合肥工业大学 电子商务研究所 钱洋 email:1563178220@qq.com . 内容可能有不到之处,欢迎交流. 未经本人允许禁止转载. 文章目录 问题背景 问题解决 完整的案例代码 ...

  5. Java网络爬虫学习记录(请求基础篇)

    目录 个人实验遇见错误集: 一.javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX ...

  6. Java网络爬虫实操(5)

    上一篇:Java网络爬虫实操(4) 大家好,前几篇文章介绍的URL都是返回HTML内容的,然后再从HTML字符串里解析出我们想要的数据. 但是,随着前端编程技术的发展,至少十多年前开始ajax.jso ...

  7. Java网络爬虫实操(8)

    上一篇:Java网络爬虫实操(7) 大家好,本篇文章介绍一下NetDiscovery爬虫框架里的downloader对象 1) 前言 面向对象设计仍然是目前编程的核心思想,从下面截图可以了解爬虫框架的 ...

  8. 第三十六期:学 Java 网络爬虫,需要哪些基础知识?

    说起网络爬虫,大家想起的估计都是 Python ,诚然爬虫已经是 Python 的代名词之一,相比 Java 来说就要逊色不少.有不少人都不知道 Java 可以做网络爬虫,其实 Java 也能做网络爬 ...

  9. python网络爬虫、Java 网络爬虫,哪个更好?

    说起网络爬虫,大家想起的估计都是 Python ,诚然爬虫已经是 Python 的代名词之一,相比 Java 来说就要逊色不少.有不少人都不知道 Java 可以做网络爬虫,其实 Java 也能做网络爬 ...

  10. 学 Java 网络爬虫,需要哪些基础知识?

    说起网络爬虫,大家想起的估计都是 Python ,诚然爬虫已经是 Python 的代名词之一,相比 Java 来说就要逊色不少.有不少人都不知道 Java 可以做网络爬虫,其实 Java 也能做网络爬 ...

最新文章

  1. linux搭建markdown服务,Markdown新手快速入门基础教程及Ubuntu下的安装
  2. devops 成长路线
  3. sublime text3安装
  4. RAC (双节点) + 单实例 DATAGUARD 安装遇到的问题处理
  5. 如何设置jinternalframe无边框_word文档美化技巧:加个边框提升版面颜值
  6. linux ftp解压命令 cannot fid or open,系统中无卷
  7. 做网站用UTF-8编码还是GB2312编码?
  8. 树形打印lua table表
  9. CSS学习总结(5)——列表/表格/链接/鼠标光标样式
  10. Access2016学习12
  11. 数据结构期末大题速成
  12. 母亲产前压力、胎儿大脑连接和分娩时的胎龄之间的交互关系
  13. java如何保证数据安全_java高并发下怎么保障数据安全?有哪些办法?
  14. 数据分析基础——数据规整
  15. n个台阶,每次都可以走一步,走两步,走三步,走到顶部一共有多少种可能
  16. linux shell 获取当月第一天与最后一天,扣丁学堂Linux培训简述在shell脚本中获取上个月最后一天的日期方法...
  17. [运维] 华为交换机使用笔记
  18. 高效开发(一):装机必备
  19. 2020年全国各省、各个地级市、各县的10米分辨率的土地利用数据的制作方法与获取
  20. iPhone助阵 网易邮箱抢占移动互联网制高点

热门文章

  1. Cocos2d-x 3.x 如何编译成安卓程序
  2. 小功能⭐️Unity动态更改 Scripting Define Symbols (宏定义)
  3. everedit如何添加右键打开
  4. 【12306刷票必备!!!】12306订票助手----无所不能的谷歌浏览器chrome插件
  5. macbook卡在进度条开不了机_mac开机卡在进度条的问题
  6. 阿里云视频点播(java)
  7. 悠哈牛奶糖为什么有五种味道单独装的,而不是混合装的
  8. 蜗牛星际A单开启WOL功能
  9. 关于机器学习中鲁棒性和泛化能力
  10. html5苹果手机视频不自动播放,HTML5 解决苹果手机不能自动播放音乐问题