cnuernber / charred

zero dependency efficient read/write of json and csv data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serialization of Instant is not consistent with other libs

kawas44 opened this issue · comments

commented

Hello,

Migrating to Charred we discovered a strange behavior in the Clojure Instant json serialization.
Here is a snippet of code to test and show the difference.

(require '[clojure.data.json :as json]
         '[cheshire.core :as cheshire]
         '[charred.api :as charred])

(def data {:timestamp #inst "2020-08-30T22:00:00.000-00:00"})

(json/write-str data)           ;; "{\"timestamp\":\"2020-08-30T22:00:00Z\"}"
(cheshire/generate-string data) ;; "{\"timestamp\":\"2020-08-30T22:00:00Z\"}"
(charred/write-json-str data)   ;; "{\"timestamp\":\"Mon Aug 31 00:00:00 CEST 2020\"}"

Is the Instant json serialization an intended behavior or could it be fixed?

Closing this - assuming referenced PR fixes to user satisfaction - please reopen if that is not the case.