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
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
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
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
>
> 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 [
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