# Pastebin 2i6wi4lR (defmacro with-aggregate/object ((stream opening-char closing-char) &body body) "Set up serialization context for aggregate serialization with the object encoder." (alexandria:with-gensyms (printed) `(progn (write-delimiter ,opening-char ,stream) (change-indentation ,stream #'+) (prog1 (let (,printed) (macrolet ((with-element-output (() &body body) `(progn (cond (,',printed (write-delimiter #\, ,',stream)) (t (setf ,',printed t))) (write-indentation ,',stream) ,@body))) ,@body)) (change-indentation ,stream #'-) (write-indentation ,stream) (write-delimiter ,closing-char ,stream)))))