> YASON is a Common Lisp library for encoding and decoding data in the >JSON> interchange format. JSON is used as a lightweight alternative to > XML. YASON has the sole purpose of encoding and decoding data and > does not impose any object model on the Common Lisp application that > uses it.
Encode OBJECT as next array element to the last JSON array opened
with WITH-ARRAY in the dynamic context. OBJECT is encoded using the
ENCODE generic function, so it must be of a type for which an ENCODE
method is defined.
ENCODE-ARRAY-ELEMENTS (&REST OBJECTS)
Encode OBJECTS, a list of JSON encodable objects, as array elements.
ENCODE-OBJECT-ELEMENT (KEY VALUE)
Encode KEY and VALUE as object element to the last JSON object
opened with WITH-OBJECT in the dynamic context. KEY and VALUE are
encoded using the ENCODE generic function, so they both must be of a
type for which an ENCODE method is defined.
ENCODE-OBJECT-ELEMENTS (&REST ELEMENTS)
Encode plist ELEMENTS as object elements.
Return true if OBJECT is a NULL, and NIL otherwise.
Parse INPUT, which needs to be a string or a stream, as JSON.
Returns the lisp representation of the JSON structure parsed. The
keyword arguments can be used to override the parser settings as
defined by the respective special variables.
Open a JSON array, then run BODY. Inside the body,
ENCODE-ARRAY-ELEMENT must be called to encode elements to the opened
array. Must be called within an existing JSON encoder context, see
WITH-OUTPUT and WITH-OUTPUT-TO-STRING*.
WITH-OBJECT (NIL &BODY BODY)
Open a JSON object, then run BODY. Inside the body,
ENCODE-OBJECT-ELEMENT or WITH-OBJECT-ELEMENT must be called to encode
elements to the object. Must be called within an existing JSON
encoder context, see WITH-OUTPUT and WITH-OUTPUT-TO-STRING*.
WITH-OBJECT-ELEMENT ((KEY) &BODY BODY)
Open a new encoding context to encode a JSON object element. KEY
is the key of the element. The value will be whatever BODY
serializes to the current JSON output context using one of the
stream encoding functions. This can be used to stream out nested
Set up context for aggregate serialization for the stream encoder.
ENCODE (OBJECT &OPTIONAL STREAM)
Encode OBJECT to STREAM in JSON format. May be
specialized by applications to perform specific rendering. STREAM
defaults to *STANDARD-OUTPUT*.
Encode OBJECT, presumably a CLOS object as a JSON object, invoking
the ENCODE-SLOTS method as appropriate.
Generic function to encode objects. Every class in a hierarchy
implements a method for ENCODE-OBJECT that serializes its slots.
It is a PROGN generic function so that for a given instance, all
slots are serialized by invoking the ENCODE-OBJECT method for all
classes that it inherits from.