Closed ckonstanski closed 7 years ago
I notice that the explicit encoder can do it, although you then must use explicit data structures all through:
* (in-package :cl-json)
#<PACKAGE "JSON">
* (with-explicit-encoder (encode-json-to-string `(:alist . ((:yes . ,(json-bool t)) (:no . ,(json-bool nil))))))
"{\"yes\":true,\"no\":false}"
Take a look at (DESCRIBE 'ENCODE-JSON)
under the method that accepts a list, for information on the explicit encoder.
Got this solution incorporated into my code. It works! Thanks.
I can get (encode-json) to emit a value of true quite easily: just use t. But I cannot figure out how to get a value of false.
I'm not talking about the strings "true" and "false". I'm talking about the javascript keywords true and false.
I tried (cl-json:json-bool nil). This gives me ["false"]. I also tried (cl-json:json-bool :false). It gives me ["true"].
What is the trick to getting false into my JSON?