diff options
Diffstat (limited to 'lib/oneliner.lisp')
-rw-r--r-- | lib/oneliner.lisp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/oneliner.lisp b/lib/oneliner.lisp index 4828b2d..668a82c 100644 --- a/lib/oneliner.lisp +++ b/lib/oneliner.lisp @@ -94,3 +94,18 @@ (string-trim '(#\space) (alexandria-2:subseq* (oneliner-brief ol) x (+ x *term-width*))))) (format t "~%~a~%~%" (oneliner-oneliner ol)))) + +;;;; json serialization + +(defun oneliner-to-json-body (ol) + "Takes a oneliner structure and produces some json suitable for +sending to the server. ID and some other fields are omitted." + (jonathan:to-json + (list :oneliner (oneliner-oneliner ol) + :tags (oneliner-tags ol) + :brief (oneliner-brief ol) + :name (if (plusp (length (oneliner-name ol))) + (oneliner-name ol) + :null) + :explanation (oneliner-explanation ol) + :runstyle (oneliner-runstyle ol)))) |