Skip to content

Commit

Permalink
Merge branch 'bfabry/beau/allow-non-const-bools'
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed Jan 13, 2017
2 parents 601bdf3 + 847077d commit 099d74c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cheshire/parse.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/cheshire/test/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))

0 comments on commit 099d74c

Please sign in to comment.