- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 clj-http 版本 2.2.0 从 REST 资源中读取 JSON,但无论我做什么,我都会将结果作为字符串。
在调试时,我将对此请求所做的操作剥离到我的网络服务器上的静态 JSON 文档 https://nym.at/test.json :
{"foo":1,"bar":"baz"}
client
绑定(bind)到命名空间 clj-http.client):
(client/get "https://nym.at/test.json" {:as :json :insecure? true})
{:status 200,
:headers {"Server" "Apache/2.4.18 (Debian)",
"Upgrade" "h2,h2c",
"Content-Type" "application/json",
"Content-Length" "22",
"Strict-Transport-Security" "max-age=31536000; includeSubDomains",
"Connection" "Upgrade, close",
"Accept-Ranges" "bytes",
"ETag" "\"16-532fcf29f30c6\"",
"Date" "Mon, 16 May 2016 22:14:59 GMT",
"Last-Modified" "Mon, 16 May 2016 22:14:27 GMT"},
:body "{\"foo\":1,\"bar\":\"baz\"}\n",
:request-time 637,
:trace-redirects ["https://nym.at/test.json"],
:orig-content-encoding nil}
{:as :json}
应该导致 clj-http 将响应解析为 JSON 并将其返回到
:body
还是我在这里做错了什么?
最佳答案
添加 [cheshire "5.6.1"]
到你的项目,它会神奇地开始工作
看
https://github.com/dakrone/clj-http#optional-dependencies
关于json - clj-http 不返回 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37264250/
这是我的问题:每次打开新的 repl 时,我都需要运行一些代码,在 Google 中搜索我发现我可以使用文件 init.clj 或 user.clj (使用 Leiningen) 这是我需要运行的代码
storm操作zookeeper的主要函数都定义在命名空间backtype.storm.cluster中(即cluster.clj文件中)。 backtype.storm.cluster定义了两个重
我刚刚开始使用 clojure,并且对 core.clj 有一个非常基本的问题。 关于它的约定是什么?什么代码应该去那里?公共(public)API? 它是由 leiningen 在创建项目时生成的。
我正在使用 clj-pdf生成pdf文件。正如 README 文件所建议的,该库提供了一些基本的模板选项。 例如,给定一个 map 向量,如: (def employees [{:country
我一直在尝试使用 to-local-date-time、org.joda.time.DateTimeZone/getDefault、格式化程序等,但我仍然不知道如何获取我存储的日期时间作为 UTC 以
我有以下无意义的 *.clj 文件: (ns bar.zar.Foo (:gen-class :main true)) (println "foo") (defn -main [& args]
Leiningen 中是否有与此 clj 命令等效的命令: clj -m project.core 看起来如果我使用 Leiningen,我需要先创建 project.clj,然后才能运行它 lein
我想使用 clj-http,因此我使用 lein 创建了一个项目,并在 project.clj 中包含这些依赖项: (defproject app "0.1.0-SNAPSHOT" :descript
如何安装旧版本的boot clj?我需要 2.7.2 版本,但实际上正在安装 2.8.3。我的操作系统是 Debian 9。 最佳答案 方法是放一个文件boot.properties: #http:/
我刚刚将我的系统从 Java 8 更新到 OpenJDK Java 11 版本。我有一个无法编译的项目,并且出现以下错误: Java.lang.IllegalArgumentException: Mu
我正在尝试使用 clj-http 版本 2.2.0 从 REST 资源中读取 JSON,但无论我做什么,我都会将结果作为字符串。 在调试时,我将对此请求所做的操作剥离到我的网络服务器上的静态 JSON
我想从命令行搜索和安装 clojure 依赖项。 是否存在工具/leiningen 命令/lein change脚本?/...可以: 在线搜索 clojure 库 重写 project.clj包含依赖
我是Clojure的新手,而且我不太了解如何编写project.clj,因此它对lein repl和lein run都适用。这是(整个路径:~/my-project/project.clj): (de
我正在尝试设置 proto-repl atom-editor 包,显然它需要一个文件 user.clj 存在于某处 - 我猜这是一些 leiningen 的 init 文件。 我应该在哪里创建这个文件
我已经通过 Google 搜索这个问题很长一段时间了,但我找不到 clj-time 的最终解决方案。我想按区域设置自动格式化日期,例如 this example或here 。我该如何使用 clj-ti
我需要向外部服务 (Twilio) 发出 Web 请求,并为同一参数指定多个值,例如 GET /some-url?status=1&status=2&status=3 我如何告诉 clj-http 像
我正在使用 lein 来管理我的项目,并且我有许多 :dependency 以及 :dev-dependency。有没有办法查明这些依赖项是否有可用的更新? 最佳答案 我自己没有尝试过,但是有Lice
在 haskell 中,通过自定义 ~/.ghci 进入其交互环境时,我可以自动使用“test.hs”中定义的函数。 >cat ~/.ghci :def hoogle \str -> return $
我正在使用 boot 构建 Clojure&ClojureScript 项目。显然,它取决于许多拥有所有许可证的第三方图书馆。大多数这些许可都要求在生成的可交付成果中提及依赖项的版权。 我找不到启动插
我有一个代码是 clj-http 的组合, core.async设施和 atom .它创建了一些线程来获取和解析一堆页面: (defn fetch-page ([url] (fetch-page
我是一名优秀的程序员,十分优秀!