aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/json
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-05-12 19:51:54 +0000
committerStuart Sierra <mail@stuartsierra.com>2009-05-12 19:51:54 +0000
commitf6266fbcd45ce1695244b8b01fcb55df2c741b2d (patch)
tree6f1f82d584bebdc121e00ca18db7a9d61ba75409 /src/clojure/contrib/json
parentce884883d8829276da9416a7d32d09a5b79456f2 (diff)
json/write.clj: fixed bug with nils in sequences
Diffstat (limited to 'src/clojure/contrib/json')
-rw-r--r--src/clojure/contrib/json/write.clj12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/clojure/contrib/json/write.clj b/src/clojure/contrib/json/write.clj
index 000fb9ea..5395c57e 100644
--- a/src/clojure/contrib/json/write.clj
+++ b/src/clojure/contrib/json/write.clj
@@ -79,11 +79,13 @@ Within strings, all non-ASCII characters are hexadecimal escaped.
(defmethod print-json ::array [s]
(print \[)
(loop [x s]
- (when-let [fst (first x)]
- (print-json fst)
- (when-let [nxt (next x)]
- (print \,)
- (recur nxt))))
+ (when (> (count x) 0)
+ (let [fst (first x)]
+ (print-json fst)
+ (let [nxt (next x)]
+ (when (> (count nxt) 0)
+ (print \,)
+ (recur nxt))))))
(print \]))
(defmethod print-json ::object [m]