diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2010-11-30 12:56:30 -0500 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2010-11-30 12:56:30 -0500 |
commit | 82c7d49ac23ff2b32490319e458ad535b01e7a41 (patch) | |
tree | 09e554c5bc3778713e93b055c99f63226d90947a | |
parent | 5380552375c8b074d979cb1d1b8a8382bdf8a999 (diff) |
Document JSON option; refs #100 CONTRIB-100
-rw-r--r-- | modules/json/src/main/clojure/clojure/contrib/json.clj | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/json/src/main/clojure/clojure/contrib/json.clj b/modules/json/src/main/clojure/clojure/contrib/json.clj index 12f03aa8..5b42e17e 100644 --- a/modules/json/src/main/clojure/clojure/contrib/json.clj +++ b/modules/json/src/main/clojure/clojure/contrib/json.clj @@ -303,7 +303,11 @@ {:write-json write-json-generic}) (defn json-str - "Converts x to a JSON-formatted string." + "Converts x to a JSON-formatted string. + + Valid options are: + :escape-unicode false + to turn of \uXXXX escapes of Unicode characters." [x & options] (let [{:keys [escape-unicode] :or {escape-unicode true}} options sw (StringWriter.) @@ -312,7 +316,11 @@ (.toString sw))) (defn print-json - "Write JSON-formatted output to *out*" + "Write JSON-formatted output to *out*. + + Valid options are: + :escape-unicode false + to turn off \uXXXX escapes of Unicode characters." [x & options] (let [{:keys [escape-unicode] :or {escape-unicode true}} options] (write-json x *out* escape-unicode))) @@ -342,7 +350,11 @@ :else (pprint-json-generic x escape-unicode))) (defn pprint-json - "Pretty-prints JSON representation of x to *out*" + "Pretty-prints JSON representation of x to *out*. + + Valid options are: + :escape-unicode false + to turn off \uXXXX escapes of Unicode characters." [x & options] (let [{:keys [escape-unicode] :or {escape-unicode true}} options] (write x :dispatch #(pprint-json-dispatch % escape-unicode)))) |