Saving Java objects/Clojure forms to text file

2012-04-16 Thread Adam Markham
I want to save a list of Clojure maps to a text file. The problem is I have a :date key which contains a java.util.Date object, At the moment I am using: (spit file.txt clj-map) to save the file. However the dates are printed in the format #Date Mon Apr 16 15:22:27 BST 2012 How can I store the

Re: Saving Java objects/Clojure forms to text file

2012-04-16 Thread David Powell
How can I store the date in a text file and read it back without falling back on Java serialization? Upgrade to Clojure 1.4, which includes extensible support for parsing and serializing custom data types, with dates being one of the built-in types. It will all work automatically. -- Dave

Re: Saving Java objects/Clojure forms to text file

2012-04-16 Thread Jay Fields
I would serialize to json and save the dates in millis. That's been working for me for quite awhile. Cheers, Jay On Mon, Apr 16, 2012 at 10:29 AM, Adam Markham adamjmark...@gmail.com wrote: I want to save a list of Clojure maps to a text file. The problem is I have a :date key which contains a

Re: Saving Java objects/Clojure forms to text file

2012-04-16 Thread Adam Markham
Thanks. Ended up going the Clojure 1.4 instant literal way as I just wanted to read and write the dates not use them for anything else. Thanks, Adam On Apr 16, 3:37 pm, David Powell djpow...@djpowell.net wrote: How can I store the date in a text file and read it back without falling back on