Permalink
Browse files

Document JSON option; refs #100 CONTRIB-100

  • Loading branch information...
1 parent 5380552 commit 82c7d49ac23ff2b32490319e458ad535b01e7a41 @stuartsierra stuartsierra committed Nov 30, 2010
Showing with 15 additions and 3 deletions.
  1. +15 −3 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))))

0 comments on commit 82c7d49

Please sign in to comment.