Ring responses in JSON
Clojure
Switch branches/tags
Nothing to show
Latest commit bba0128 Oct 9, 2012 @weavejester Merge pull request #3 from rbxbx/patch-1
Close version string in dependency declaration
Permalink
Failed to load latest commit information.
src/ring Added ring.middleware.json-response Apr 7, 2012
test/ring Added ring.middleware.json-response Apr 7, 2012
.gitignore
README.md Close version string in dependency declaration Oct 9, 2012
project.clj Released 0.2.0 Apr 7, 2012

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.