# HG changeset patch # User Steve Losh # Date 1595990891 14400 # Node ID 3dbd9b45cf559c7570c9f7a8447c2f3498652b96 # Parent 5a32a34392a2711e6b5748f447e94ea3e3eac4a5 Convert symbols to snake case instead of just downcasing diff -r 5a32a34392a2 -r 3dbd9b45cf55 src/main.lisp --- a/src/main.lisp Tue Jul 28 21:28:29 2020 -0400 +++ b/src/main.lisp Tue Jul 28 22:48:11 2020 -0400 @@ -257,10 +257,14 @@ ;;;; Object Parsers ----------------------------------------------------------- +(defun lisp-case-to-snake-case (string) + "Convert a Lisp-cased string designator `\"FOO-BAR\"` into snake cased `\"foo_bar\"`." + (substitute #\_ #\- (string-downcase string))) + (defclass json-class (standard-class) ((slot-name-to-json-name :accessor slot-name-to-json-name :initarg :slot-name-to-json-name - :initform 'string-downcase) + :initform 'lisp-case-to-snake-case) (unknown-slots :accessor unknown-slots :initarg :unknown-slots :initform :discard)