Created
July 28, 2017 11:22
-
-
Save alehatsman/2f634fa7f80a9f25092f1a2e4cccef2e to your computer and use it in GitHub Desktop.
Aleph http client get request and parse body from json to clojure map.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[aleph.http :as http] | |
'[byte-streams :as bs] | |
'[cheshire.core :as cheshire] | |
'[manifold.deferred :as d]) | |
(defn input-stream-to-buffered-reader [is] | |
(new BufferedReader (new InputStreamReader is))) | |
(defn parse-json-input-stream [is] | |
(-> (input-stream-to-buffered-reader is) | |
(cheshire/parse-stream))) | |
(d/chain (http/get "https://api.json") | |
:body | |
parse-json-input-stream) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment