My concern is more to do with the reader, I think extending writer
works quite well, it would be nice if it was possible to do the same
thing with the reader, so you could specify how to deserialize
specific types of data. Right now it seems to be baked into read-json-
reader and there's no easy way to extend it.

Maybe it could be possible to specify how to deserialize data based on
the key names, then if the reader hits a key with the given name it
would try to deserialize it with the given function or something?

On Aug 20, 3:32 pm, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
> Since there is no standard for how to represent dates in JSON, it is
> unlikely to be built in.  But you can extend the writer with
> application-specific date formats.
> -S
>
> On Aug 20, 2:15 pm, Dmitri <dmitri.sotni...@gmail.com> wrote:
>
>
>
> > I'm currently using Dan Larkin's clojure-json, and it provides a way
> > to serialize and deserialize dates, it also provides the option to
> > specify custom serializers, eg:
>
> > (defn date-encoder
> >         [date writer pad current-indent start-token-indent indent-
> > size]
> >         (.append writer (str start-token-indent \" date \")))
>
> > I was looking at switching to using the json implementation in clojure-
> > contrib, but noticed that it doesn't handle dates nor does it provide
> > a way to register custom serializers, is there a plan to implement
> > that in the future, or is the proper approach to simply extend Write-
> > JSON whenever a custom serializer/deserializer is needed.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to