Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle when hashmap keys are bignums

  • Loading branch information...
commit 944a3e33596e83a0c56ed08cf981778af38aecfe 1 parent 5253caf
Dan Larkin danlarkin authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  src/org/danlarkin/json/encoder.clj
  2. +4 −0 test/test.clj
2  src/org/danlarkin/json/encoder.clj
View
@@ -75,7 +75,7 @@
#^String pad #^String current-indent #^Integer indent-size]
(let [next-indent (get-next-indent current-indent indent-size)
k (key pair)
- ke (if (integer? k) (str k) k)]
+ ke (if (number? k) (str k) k)]
(encode-helper ke writer pad current-indent indent-size)
(.append writer ":")
(encode-helper (val pair) writer pad "" indent-size next-indent)))
4 test/test.clj
View
@@ -56,6 +56,10 @@
(is (= "{\"1\":1}"
(json/encode-to-str {1 1}))))
+(deftest single-object-bignum-key
+ (is (= "{\"1.0E25\":1}"
+ (json/encode-to-str {1e25 1}))))
+
(deftest easy-number
(is (:json= 10)))
Please sign in to comment.
Something went wrong with that request. Please try again.