-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Yason does not encode a lisp pure cons (a pure cons is a cons whose cdr is not a cons) into json correctly. For example, an attempt to encode (1 . 2) returns the error.
* (ql:quickload :yason)
* (yason:encode (cons 1 2) *standard-output*)
#<THREAD "main thread" RUNNING {7008680273}>:
The value
2
is not of type
LISTThis is because (defmethod encode ((object list) ..) treats "pure cons" as lists too,
which seems to be a "feature" of common lisp.
* (defmethod test ((object list)) (pprint object))
#<STANDARD-METHOD COMMON-LISP-USER::TEST (LIST) {7005484C83}>
* (test (cons 1 2))
(1 . 2)Solutions:
- Make it more explicit that "pure cons" are not supported.
- Support encoding pure cons.
Metadata
Metadata
Assignees
Labels
No labels