How to print EDN output in JSON format using Cheshire custom encoder
问题 I am newbie with Clojure and I am trying to print EDN output to valid JSON format using Cheshire custom encoder for classes defined in java. My EDN file: {:xyz #XyzBuilder "testString"} Clojure code: (defn getXyz [str] (.getXyz (XyzBuilder.) str) ) (defn custom-readers [] {'xyz/builder getXyz} ) (add-encoder com.java.sample.Xyz (fn [c jsonGenerator] (.writeString jsonGenerator (str c)))) (edn/read-string {:readers (custom-readers)} (slurp filename) ) This generates below output: {"xyz":"Xyz