Skip to content

bug: `replacer' is not called when writing [CLOS] objects #79

@fstamour

Description

@fstamour

The code to repro the bug:

(defun json-replacer (key value)
  (declare (ignorable key))
  (typecase value
    (null t)
    (symbol (values t (string-downcase value)))
    (t t)))


;;; stringify'ing a hash-table: works

(let ((ht (make-hash-table)))
  (setf (gethash :slot ht) :keyword)
  (com.inuoe.jzon:stringify
   ht
   :replacer 'json-replacer))
;; => "{\"slot\":\"keyword\"}"
;; as expected


;;; stringify'ing an object: doesn't work

(defclass object () ((slot :initarg :slot)))

(com.inuoe.jzon:stringify
 (make-instance 'object :slot :keyword)
 :replacer 'json-replacer)
;; => "{\"slot\":\"KEYWORD\"}"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions