Skip to content

Instantly share code, notes, and snippets.

@maxweber
Created March 1, 2011 10:26
Show Gist options
  • Save maxweber/848948 to your computer and use it in GitHub Desktop.
Save maxweber/848948 to your computer and use it in GitHub Desktop.
Using the clj-facebook-graph middleware wrap-json-response-conversion to convert Facebook JSON responses automatically to a corresponding Clojure data structure
user> (use 'clojure.pprint)
nil
user> (require '[clj-http.client :as client])
nil
user> (def request (wrap-json-response-conversion (client/wrap-request #'clj-http.core/request)))
#'user/request
user> (pprint (:body (request {:method :get :url "https://graph.facebook.com/btaylor"})))
{:id "220439",
:name "Bret Taylor",
:first_name "Bret",
:last_name "Taylor",
:link "http://www.facebook.com/btaylor",
:gender "male",
:locale "en_US"}
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment