The json that I am trying to access is library catalog data from my librarything.com account. I can set up a link or otherwise supply the json input, if required.
I did RTFM, by the way. But I admit my CLOS is a bit rusty, and frankly I did not really grok what the documentation was trying to tell me.
Here is what I did in emacs/slime with clozure common lisp as my CL:
Code: Select all
CL-USER> (ql:quickload :cl-json)
To load "cl-json":
Load 1 ASDF system:
cl-json
; Loading "cl-json"
(:CL-JSON)
CL-USER> (json:set-decoder-simple-clos-semantics)
#<Compiled-function JSON:DECODE-JSON #x30200112BF6F>
CL-USER> (setf *jsf* (open "librarything_thierrygar-1.json"))
#<BASIC-FILE-CHARACTER-INPUT-STREAM ("librarything_thierrygar-1.json"/5 UTF-8) #x3020012969DD>
CL-USER> (setf *json-clos* (json:decode-json *jsf*))
#<An instance of #<JSON:FLUID-CLASS NIL> #x302001479E4D>
CL-USER> (inspect *json-clos*)
[0] #<An instance of #<JSON:FLUID-CLASS NIL> #x3020012E5D9D>
[1] Class: #<JSON:FLUID-CLASS NIL>
[2] Wrapper: #<CCL::CLASS-WRAPPER NIL #x3020012E70DD>
Instance slots
[3] :LF: #<Unbound>
[4] :FL: #<Unbound>
[5] :|0|: #<Unbound>
[6] :|2|: #<Unbound>
[7] :CODE: #<Unbound>
[8] :|1|: #<Unbound>
[9] :TEXT: #<Unbound>
[10] :BOOKS--ID: #<Unbound>
[11] :TITLE: #<Unbound>
[12] :SORTCHARACTER: #<Unbound>
[13] :PUBLIC: #<Unbound>
[14] :PRIMARYAUTHOR: #<Unbound>
[15] :SECONDARYAUTHOR: #<Unbound>
[16] :AUTHORS: #<Unbound>
[17] :COLLECTIONS--ID-A: #<Unbound>
[18] :COLLECTIONS: #<Unbound>
Inspect>