Read file contents as map

2014-01-26 Thread Paul Smith
Hi, I have a config file that contains a Clojure map. If I slurp that file it obviously returns a string. Is it possible to return that read file as a map (its original data structure) and not a string? Thanks Paul -- -- You received this message because you are subscribed to the Google

Re: Read file contents as map

2014-01-26 Thread mynomoto
If you are sure that the file doesn't contain malicious code you can use: (read-string (slurp file)) On Sunday, January 26, 2014 11:24:30 AM UTC-2, Paul Smith wrote: Hi, I have a config file that contains a Clojure map. If I slurp that file it obviously returns a string. Is it possible

Re: Read file contents as map

2014-01-26 Thread Jan Herich
And if you are not sure about that, just use edn-only reader: (require '[clojure.tools.reader.edn :as edn]) (edn/read-string (slurp file)) Dňa nedeľa, 26. januára 2014 17:12:32 UTC+1 mynomoto napísal(-a): If you are sure that the file doesn't contain malicious code you can use: (read-string