Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7be7f5d5e7
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (25 sloc) 0.728 kb

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.

Jump to Line
Something went wrong with that request. Please try again.