I'm completely new with Clojure and I'm trying to do some basic stuff with Slurp and JSON.
I found some code (doesn't work) that I'm using as an example to try to learn some basics.
The following code is supposed to get some JSON data from Ipinfo.io and then pull JUST the City name from it and print it.
I'm getting so many errors with the namespaces that I can't even get to testing the actual code. :-(
Any help would be GREATLY appreciated ! :-)
Jason
(ns my-namespace
(:require [clojure.core :as core]
[clojure.data.json :as json]))
(defn get-city [ip-addr]
(let [resp (core/slurp (str "https://ipinfo.io" ip-addr "/json"))
city-name (->> resp
(json/read-str)
:city)]
(core/prn city-name)
city-name))