Permalink
Browse files

update README to reflect new default behavior

  • Loading branch information...
1 parent ad2e4ed commit 58decfb46ff6d90a80237cd75ffd654fac59315d @lancepantz lancepantz committed Sep 20, 2011
Showing with 1 addition and 3 deletions.
  1. +1 −3 README.md
View
4 README.md
@@ -26,18 +26,16 @@ Fast JSON encoding and decoding for Clojure via the Jackson library.
## Encoding/Decoding Details
`clj-json` can generate JSON for maps, vectors, lists, keywords, strings, integers, doubles, floats, and booleans.
-By default sets will be coerced into lists.
Note that keywords generate as strings without a leading :, and will read via `parse-string` and `parsed-seq` as strings,
however both have an optional boolean argument to keywordize the keys of maps.
-Namespaced keywords will encode to the form "namespace/keyword" by default.
## Redefining Coercions
Coercions can be redefined by binding `*coercions*`. For example, to coerce sets into existence map:
```clojure
-(binding [clj-json.core/*coercions* {clojure.lang.IPersistentSet (fn [x] (reduce (fn [acc x] (assoc acc x true)) {} x))}]
+(binding [clj-json.core/*coercions* {clojure.lang.PersistentHashSet (fn [x] (reduce (fn [acc x] (assoc acc x true)) {} x))}]
(is (= {"foo" {"bang" true, "bar" true}}
(json/parse-string
(json/generate-string {"foo" #{"bar" "bang"}})))))

0 comments on commit 58decfb

Please sign in to comment.