diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2009-05-12 19:51:54 +0000 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2009-05-12 19:51:54 +0000 |
commit | f6266fbcd45ce1695244b8b01fcb55df2c741b2d (patch) | |
tree | 6f1f82d584bebdc121e00ca18db7a9d61ba75409 /src/clojure/contrib/json | |
parent | ce884883d8829276da9416a7d32d09a5b79456f2 (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.clj | 12 |
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] |