Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Declined
-
Affects Version/s: Release 1.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Patch:None
Description
The doc says "Recursively transforms all map keys from keywords to strings." however only those keys that pass keyword? get transformed to string. This leaves other keys such as java.Long as-is.
A simple fix would be
(defn stringify-keys*
"Recursively transforms all map keys from keywords to strings."
[m]
(let [f (fn [[k v]] (if (keyword? k) [(name k) v] [(str k) v]))]
;; only apply to maps
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))