封装的Json请求库

195 阅读1分钟
原文链接: www.jcodecraeer.com

GetJsonData

仅需要一行代码就获取Json数据

1.不带请求参数

  1. String jsondata= GetJsonData.excuteByget( "http://dxb.iwakeup.cn/posts");

2.带请求参数

  1. Map<String,String> map = new HashMap<String,String>();
  2. map.put("body","test");
  3. map.put("detail","test");
  4. String jsondata1= GetJsonData.excuteByPost( "http://dxb.iwakeup.cn/posts?",map);

在根build.gradle 中添加

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

在module的build.gradle中添加

  1. compile'com.github.huminted:GetJsonData:v0.1'
  2. AS 3.0+
  3. implementation 'com.github.huminted:GetJsonData:v0.1'