What's the best way to parse a map in clojure when using clj.http?

170 Views Asked by At

I have a map like so


(client/post "http://localhost:5000" {:form-params {:new {:title "some-title" :description "some-description"}}})

In the server, I have the following:

(get-in request [:form-params "new"])

Which gives me the following:

"{:title \"some-title\", :description \"some-description\"}"

A string and not an actual map. Using the Cheshire library's parse-string gives the ": unexpected" error. How do I fix this?

1

There are 1 best solutions below

1
cfrick On

Add :content-type :application/edn to your request map, to parse EDN. Add :as :auto, :coerce :always to do the coercion automatically.