序列化 / 二进制格式

(require '[clojure.edn :as edn])

(def dic {1 "one" 2 "two"})

; unlike JSON, EDN keeps the key type
; Encoding Binary Data
(def data-b (.getBytes (pr-str dic) "UTF-8"))

; Decoding Binary Data
(def dic2 (edn/read-string (String. data-b "UTF-8")))
; dic2 is {1 "one", 2 "two"}

(prn dic2)
(println "type is" (type dic2))