CL-USER> (asdf:load-system "json-readtable")
=> T
CL-USER> (use-package :json-readtable)
=> T
CL-USER> (let ((*readtable* *json-readtable*))
(gethash
"Hello, World!"
(read-from-string "{\"Hello, World!\": [3.14, true, false, null]}")))
=> #(3.14 T NIL :NULL)
CL-USER> (with-json-readtable (:object :plist
:array :list
:true "apple"
:false "banana"
:null 'yum)
(read-from-string "{\"Hello, World!\": [3.14, true, false, null]}"))
=> ("Hello, World!" (3.14 "apple" "banana" YUM))
=> 44- Set
*JSON-OBJECT*to:HASH-TABLE(default),:ALIST, or:PLIST - Set
*JSON-ARRAY*to:VECTOR(default) or:LIST - Set
*JSON-TRUE*,*JSON-FALSE*,*JSON-NULL*to your desired values.
- If the first non-whitespace char of a stream is not ASCII, behavior is
implementation dependent. It’s reasonable to check that
(FIND (PEEK-CHAR T STREAM NIL NIL NIL) "{[\"-0123456789tfn")
is true before a top-level read.
- We assume host implements
CL:CHAR-CODEandCL:CODE-CHARusing Unicode code points. - This library may trigger bugs in Slime or Sly due to readtable conflicts.
- This code was developed on SBCL and may have issues on untested implementations.