Liking cljdoc? Tell your friends :D

ring.middleware.json

Ring middleware for parsing JSON requests and generating JSON responses.

Ring middleware for parsing JSON requests and generating JSON responses.
raw docstring

default-malformed-responseclj

The default response to return when a JSON request is malformed.

The default response to return when a JSON request is malformed.
sourceraw docstring

json-body-requestclj

(json-body-request request options)

Parse a JSON request body and assoc it back into the :body key. Returns nil if the JSON is malformed. See: wrap-json-body.

Parse a JSON request body and assoc it back into the :body key. Returns nil
if the JSON is malformed. See: wrap-json-body.
sourceraw docstring

json-params-requestclj

(json-params-request request options)

Parse the body of JSON requests into a map of parameters, which are added to the request map on the :json-params and :params keys. Returns nil if the JSON is malformed. See: wrap-json-params.

Parse the body of JSON requests into a map of parameters, which are added
to the request map on the :json-params and :params keys. Returns nil if the
JSON is malformed. See: wrap-json-params.
sourceraw docstring

json-responseclj

(json-response response options)

Converts responses with a map or a vector for a body into a JSON response. See: wrap-json-response.

Converts responses with a map or a vector for a body into a JSON response.
See: wrap-json-response.
sourceraw docstring

JsonStreamingResponseBodyclj

source

wrap-json-bodyclj

(wrap-json-body handler)
(wrap-json-body handler options)

Middleware that parses the body of JSON request maps, and replaces the :body key with the parsed data structure. Requests without a JSON content type are unaffected.

Accepts the following options:

:key-fn - function that will be applied to each key :keywords? - true if the keys of maps should be turned into keywords :bigdecimals? - true if BigDecimals should be used instead of Doubles :malformed-response - a response map to return when the JSON is malformed

Middleware that parses the body of JSON request maps, and replaces the :body
key with the parsed data structure. Requests without a JSON content type are
unaffected.

Accepts the following options:

:key-fn             - function that will be applied to each key
:keywords?          - true if the keys of maps should be turned into keywords
:bigdecimals?       - true if BigDecimals should be used instead of Doubles
:malformed-response - a response map to return when the JSON is malformed
sourceraw docstring

wrap-json-paramsclj

(wrap-json-params handler)
(wrap-json-params handler options)

Middleware that parses the body of JSON requests into a map of parameters, which are added to the request map on the :json-params and :params keys.

Accepts the following options:

:key-fn - function that will be applied to each key :bigdecimals? - true if BigDecimals should be used instead of Doubles :malformed-response - a response map to return when the JSON is malformed

Use the standard Ring middleware, ring.middleware.keyword-params, to convert the parameters into keywords.

Middleware that parses the body of JSON requests into a map of parameters,
which are added to the request map on the :json-params and :params keys.

Accepts the following options:

:key-fn             - function that will be applied to each key
:bigdecimals?       - true if BigDecimals should be used instead of Doubles
:malformed-response - a response map to return when the JSON is malformed

Use the standard Ring middleware, ring.middleware.keyword-params, to
convert the parameters into keywords.
sourceraw docstring

wrap-json-responseclj

(wrap-json-response handler)
(wrap-json-response handler options)

Middleware that converts responses with a map or a vector for a body into a JSON response.

Accepts the following options:

:key-fn - function that will be applied to each key :pretty - true if the JSON should be pretty-printed :escape-non-ascii - true if non-ASCII characters should be escaped with \u :stream? - true to create JSON body as stream rather than string

Middleware that converts responses with a map or a vector for a body into a
JSON response.

Accepts the following options:

:key-fn            - function that will be applied to each key
:pretty            - true if the JSON should be pretty-printed
:escape-non-ascii  - true if non-ASCII characters should be escaped with \u
:stream?           - true to create JSON body as stream rather than string
sourceraw docstring

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

× close