diff --git a/src/cheshire/parse.clj b/src/cheshire/parse.clj index a882fd63..91411efd 100644 --- a/src/cheshire/parse.clj +++ b/src/cheshire/parse.clj @@ -84,7 +84,7 @@ (parse* jp key-fn *use-bigdecimals?* array-coerce-fn)))) (defn parse [^JsonParser jp key-fn eof array-coerce-fn] - (let [key-fn (or (if (identical? key-fn true) keyword key-fn) identity)] + (let [key-fn (or (if (and (instance? Boolean key-fn) key-fn) keyword key-fn) identity)] (.nextToken jp) (condp identical? (.getCurrentToken jp) nil diff --git a/test/cheshire/test/core.clj b/test/cheshire/test/core.clj index b9ba8c4a..f362d94c 100644 --- a/test/cheshire/test/core.clj +++ b/test/cheshire/test/core.clj @@ -393,3 +393,6 @@ (deftest t-float-encoding (is (= "{\"foo\":0.01}" (json/encode {:foo (float 0.01)})))) + +(deftest t-non-const-bools + (is (= {:a 1} (json/decode "{\"a\": 1}" (Boolean. true)))))