无法从获取请求中获取 JSON 数据使用 HTTPBuilder

问题描述

我尝试从 get 请求中获取 JSON 数据。

在浏览器中输入 url 时,我看到 JSON:

enter image description here

但在我的控制台中我看到了:

org.apache.http.conn.EofSensorInputStream@780f896d groovyx.net.http.HttpResponseDecorator@3ad42e2b

这是我的代码

static HttpGetJson(String url,Closure success) {
    def http = new HTTPBuilder(url)
    http.request(GET,JSON) { req ->
        response.success = success
    }
}

HttpGetJson(url) { resp,json ->
    println resp
    println json
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)