1.项目环境
idea:intellij IDEA 2017.1.4
编程语言:java
管理工具:maven
需要导包:httpclient,jsoup(解析html)等,如果要解析json可能还要导入gson的包。
我把重要的依赖贴出来(默认大家都是使用过maven的,如果不使用maven,你可以到网上下载jar包添加到项目里):
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
2.新建一个Demo类 通过doGet();获取网页JSON串 之后调用strWritedToJSONObject();方法进行转换 获取自己想要的数据
@Test
public void test1(){
String s = doGet("https://fe-api.zhaopin.com/c/i/sou?pageSize=90&cityId=530&workExperience=-1&education=-1&companyType=-1&employmentType=-1&am