This is the define-json-expander Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:57:37 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
define-json-expander
Small facility for converting between JSON and CLOS
Johan Sjölén
MIT
package.lisp
(file).
define-json-expander.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
define-json-expander/define-json-expander.asd
define-json-expander/package.lisp
define-json-expander/define-json-expander.lisp
define-json-expander/define-json-expander.asd
define-json-expander
(system).
define-json-expander/package.lisp
define-json-expander
(system).
define-json-expander/define-json-expander.lisp
package.lisp
(file).
define-json-expander
(system).
*accessor-prefix*
(special variable).
define-json-expander
(macro).
clean-option
(function).
clean-options
(function).
define-json-decoder
(macro).
flatten-n-times
(function).
get-prop
(function).
group
(function).
Packages are listed by definition order.
define-json-expander
common-lisp
.
*accessor-prefix*
(special variable).
define-json-expander
(macro).
clean-option
(function).
clean-options
(function).
define-json-decoder
(macro).
flatten-n-times
(function).
get-prop
(function).
group
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Generates a decoder function with the name decode-‘name’
The ‘slot/json-list’ is of the form (slot-name json-property-name &optional decoder-function) where
slot-name refers to the slot’s initarg
decoder-function refers to the function which will be called upon a structure if so provided
The decoder automatically takes all unused JSON-properties and puts them into the rest slot
Example definition and expansion:
(define-4chan-decoder post
(:no :no)
(:name :name)
(:e-mail :email)
(:body :com)
(:date :time))
(DEFUN DECODE-POST (POST)
"Takes a JSON document in list form and decodes it into a CLOS POST object"
(FLET ((P (KEY)
(CDR (ASSOC KEY POST))))
(MAKE-INSTANCE ’POST :NO (P :NO) :NAME (P :NAME) :E-MAIL (P :EMAIL) :BODY
(P :COM) :DATE (P :TIME) :REST
(REMOVE-IF
(LAMBDA (ELT)
(MEMBER (CAR ELT)
’((:NO :NO) (:NAME :NAME) (:E-MAIL :EMAIL)
(:BODY :COM) (:DATE :TIME))
:KEY #’CADR :TEST #’EQ))
POST))))
Returns two values, the first being the ‘direct-slot’ with the ‘option’ and its value stripped and the second being a list consisting of the name of the slot and the found prop and value. If such a prop isn’t found then the second element is NIL.
Cleans several options from several slots.
Flatten a tree by n levels of subtrees. n = 1 doesn’t flatten at all.
Jump to: | C D F G M |
---|
Jump to: | C D F G M |
---|
Jump to: | *
S |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
* | |||
*accessor-prefix* : | Public special variables | ||
| |||
S | |||
Special Variable, *accessor-prefix* : | Public special variables | ||
|
Jump to: | *
S |
---|
Jump to: | D F P S |
---|
Jump to: | D F P S |
---|