4
Joda 날짜 시간을 인코딩 :Clojure의 링 JSON과 함께 다음과 같은 응용 프로그램으로
com.fasterxml.jackson.core.JsonGenerationException : 수 없습니다 JSON 인코딩
; src/webapp/core.clj
(ns webapp.core
(:require [compojure.core :refer [defroutes GET]]
[ring.middleware.json :as mid-json]
[clj-time.jdbc]))
(defn foo [request]
{:body {:now (org.joda.time.DateTime/now)}})
(defroutes routes
(GET "/foo" [] foo))
(def app
(-> routes
(mid-json/wrap-json-response)))
은/foo는 엔드 포인트를 친 것은 나에게 오류를 제공합니다 클래스 org.joda.time.DateTime : 2017-10-21T03 : 38 : 16.207Z
Ring-json에서 DateTime 객체를 인코딩하는 간단한 방법이 있습니까? 내가 직접 미들웨어를 작성해야만 예를 들어로 변환 할 수 있습니까? 먼저 문자열? 그렇다면 어떻게해야합니까? (필자는 링 미들웨어를 작성한 적이 없습니다.) 당신은 체셔는 JSON을 생성하기 위해 사용하는 경우
[[org.clojure/clojure "1.8.0"]
[org.clojure/java.jdbc "0.6.1"]
[ring/ring-jetty-adapter "1.4.0"]
[compojure "1.4.0"]
[ring/ring-json "0.4.0"]
[clj-time "0.14.0"]]