Re: Notice: c.c.json parser and clojure.lang.Ratio

2011-01-10 Thread Michael Ossareh
On Sat, Jan 8, 2011 at 23:38, Stuart Sierra wrote: > Ratios aren't valid JSON. If the recipient is Clojure, you don't need JSON > at all, just pr-str and read-string. Of course! Thanks, mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Notice: c.c.json parser and clojure.lang.Ratio

2011-01-08 Thread Stuart Sierra
Ratios aren't valid JSON. If the recipient is Clojure, you don't need JSON at all, just pr-str and read-string. -S -- 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

Re: Notice: c.c.json parser and clojure.lang.Ratio

2011-01-08 Thread Michael Ossareh
On Sat, Jan 8, 2011 at 13:49, Stuart Sierra wrote: > There's no solution here that will be perfect for all cases. But I've made > the decision that c.c.json will always "downgrade" Clojure types to the > nearest equivalent JSON types. It does not promise round-trip preservation > of types not spec

Re: Notice: c.c.json parser and clojure.lang.Ratio

2011-01-08 Thread Stuart Sierra
There's no solution here that will be perfect for all cases. But I've made the decision that c.c.json will always "downgrade" Clojure types to the nearest equivalent JSON types. It does not promise round-trip preservation of types not specified by JSON, such as sets. In this case, that means Ra

Re: Notice: c.c.json parser and clojure.lang.Ratio

2011-01-05 Thread Michael Ossareh
> > I'm unclear on what the correct course of action in this case should be. > However this can be solved by transforming the ratios before and after to the jsonification: https://gist.github.com/767204 (clojure.walk/postwalk transform-ratio {:a [3/4] :b {:foo {:bar 3/4} :bar {:a 1}}}) => {:a [

Notice: c.c.json parser and clojure.lang.Ratio

2011-01-05 Thread Michael Ossareh
Hi, It turns out that c.c.json/json-str will spit out Ratio's in a manner which is not json compliant. (json-str [3/4]) => "[3/4]" This parses correctly in the reverse situation: (read-json (json-str [3/4])) => [3/4] When being read [1] we switch over to using the clojure form reader so this p