cheshire icon indicating copy to clipboard operation
cheshire copied to clipboard

:key-fn no longer works in generate-string?

Open wenxijuji opened this issue 4 years ago • 1 comments

;; [cheshire "5.10.1"] in project ;; [cheshire.core :as json] in require

;; copied from the github page exmaple (json/generate-string {:foo "bar"} {:key-fn (fn [k] (.toUpperCase (name k)))}) => "{\"foo\":\"bar\"}"

wenxijuji avatar Dec 02 '21 19:12 wenxijuji

This is strange to me, when I try it locally it appears to work just fine:

~/src/clj/cheshire (git) abc14504  master [origin/master]
1 » git co 5.10.1 
Note: switching to '5.10.1'.
HEAD is now at df98594 Release 5.10.1
~/src/clj/cheshire (git) df985942  tags/5.10.1
» lein repl
nREPL server started on port 35243 on host 127.0.0.1 - nrepl://127.0.0.1:35243
REPL-y 0.4.4, nREPL 0.6.0
Clojure 1.10.3
OpenJDK 64-Bit Server VM 17.0.1+12-39
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (use 'cheshire.core)
nil

user=> (generate-string {:foo "bar"} {:key-fn (fn [k] (.toUpperCase (name k)))})
"{\"FOO\":\"bar\"}"

How are you using it?

dakrone avatar Dec 06 '21 21:12 dakrone