This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-07
Channels
- # bangalore-clj (2)
- # beginners (53)
- # boot (30)
- # cider (27)
- # clara (1)
- # cljs-dev (18)
- # cljsrn (16)
- # clojure (153)
- # clojure-brasil (1)
- # clojure-dusseldorf (5)
- # clojure-italy (20)
- # clojure-losangeles (3)
- # clojure-spec (4)
- # clojure-uk (177)
- # clojurescript (115)
- # component (4)
- # core-logic (1)
- # datomic (29)
- # emacs (9)
- # figwheel (2)
- # gorilla (1)
- # graphql (36)
- # hoplon (4)
- # jobs (1)
- # jobs-discuss (3)
- # juxt (2)
- # keechma (22)
- # lumo (4)
- # off-topic (1)
- # onyx (17)
- # parinfer (96)
- # protorepl (10)
- # re-frame (31)
- # reagent (14)
- # ring-swagger (17)
- # spacemacs (32)
Hello everyone, I'm using compojure-api 1.1.11 and I'm trying to understand why a java.util.Date object is not json encoded using the default format (https://github.com/dakrone/cheshire/blob/69a3f2bad66bb9da93d9881266312cd18be4b1a9/src/cheshire/factory.clj#L10) but yyyy-MM-dd'T'HH:mm:SSS'Z'
instead. I'm trying to locate where this custom formatter is set but with no luck so far (I checked compojure-api, ring-middleware-format, ring-swagger, ...)
@rborer https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/json.clj#L23
java.util.Date is converted to JodaTime DateTime first
Muuntaja will change Cheshire to Jsonista maybe in the future (need to battle test it first), which will bring explicit write-handlers like with Edn & Transit
It's global in Cheshire https://github.com/dakrone/cheshire/issues/77
but... if you need different format for some endpoints, you can encode the response manually. Just mount a middleware for the route, it sees the coerced response.