Amogh Talpallikar
Amogh Talpallikar

Reputation: 12184

How to access a JSON webservice in Clojure?

What is the common way of accessing a web service and getting response JSON as Clojure maps ?

Do we have to use Java's java.net.URLConnection and Some JSON library like GSON ?

Is http-kit the most used library for this purpose, thats what I get via Google?

Upvotes: 1

Views: 855

Answers (2)

ponzao
ponzao

Reputation: 20934

For asynchronous HTTP you should look at http.async.client

Upvotes: 1

Jeremy
Jeremy

Reputation: 22415

Take a look at clj-http. One of its dependencies is a JSON library called cheshire.

Here's an example of a basic GET request that parses the body as JSON.

(clj-http.client/get "http://example.com/foo.json" {:as :json})

Upvotes: 7

Related Questions