Hi Josip, The latest version of c.c.json dispatches on the "type" function, which in turn uses "class." It should be pretty easily extendible. -Stuart Sierra
On May 12, 9:26 am, Josip Gracin <josip.gra...@gmail.com> wrote: > Hi! > > I'm querying a DB and getting java.sql.Timestamp in results, among > other things. When I use print-json on this, timestamps are > serialized as #<Timestamp "13:23...">. > > Stuart, any chance you could make the dispatch function for > clojure.contrib.json.write/print-json more open for extensions? > Unless I'm missing something, changing ":else :default" to ":else > (class x)" in the print-json dispatch fn definition would enable > adding serialization for custom objects. > > (defmulti > print-json (fn [x] > (cond (nil? x) nil > (map? x) :object > (coll? x) :array > (keyword? x) :keyword > :else :default))) > > -- > mr.sc. Josip Gracin, dipl.ing. > direktor razvoja > Inge-mark d.o.o., Zavrtnica 17, Zagreb > tel: +38516658139, +385919009420 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---