Serialize to different format (JSON, XML) using a common api.
This library is used in CL-REST-SERVER.
(with-output-to-string (s)
(with-serializer-output s
(with-serializer :json
(with-object ("user")
(set-attribute "id" 22)
(with-attribute ("realname")
(serialize "Mike"))
(with-attribute ("groups")
(with-list ("groups")
(with-list-member ("group")
(with-object ("group")
(set-attribute "id" 33)
(set-attribute "title" "My group")))))))))
(name value &key (serializer *serializer*) (stream *serializer-output*))
Serializes a list member
(name value &optional type formatter)
Build an object attribute to be serialized
(name &rest attributes)
Build an object to be serialized
(name &rest objects)
Build a list of objects to be serialized
(name value &rest args &key (serializer *serializer*)
(stream *serializer-output*) &allow-other-keys)
Serializes an object attribute and value
((name &key (serializer) (stream)) &body body)
Serializes an object attribute
((name &key (serializer) (stream)) &body body)
Serializes an list of objects
((name &key (serializer) (stream)) &body body)
Serializes a list member
((name &key (serializer) (stream)) &body body)
Serializes a serializing object.
(serializer &body body)
Execute body in serializer scope. Binds serializer to serializer.
Example: (with-serializer :json (serialize user))
(serializer-output &body body)
Defines the serializer output when executing body.
Example: (with-serializer-output s (with-serializer :json (serialize user)))
Main serialization function. Takes the object to serialize, the serializer and the output stream
The default api serializer
Serializer intermediate representation object attribute class
Serializer intermediate representation object class