Liking cljdoc? Tell your friends :D

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.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close