Ring responses in JSON
Clojure
Latest commit bba0128 Oct 9, 2012 @weavejester Merge pull request #3 from rbxbx/patch-1
Close version string in dependency declaration

README.md

ring-json-response

A small library for returning JSON responses from a Ring handler.

Install

Add the following dependency to your project.clj file:

[ring-json-response "0.2.0"]

Usage

You can write JSON responses using the json-response method:

(use 'ring.util.json-response)

(defn handler [request]
  (json-response {:foo "bar"})

Or use middleware to convert any response with a map as a body into JSON:

(use 'ring.middleware.json-response
     'ring.util.response)

(defn handler [request]
  (response {:foo "bar"}))

(def app
  (wrap-json-response handler))

License

Copyright © 2012 James Reeves

Distributed under the Eclipse Public License, the same as Clojure.