You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 (cons12) *standard-output*)
#<THREAD "main thread" RUNNING {7008680273}>:
The value
2
is not of typeLIST
This is because (defmethod encode ((object list) ..) treats "pure cons" as lists too,
which seems to be a "feature" of common lisp.
But it's not just plain cons cells -- what should we do for '(1 2 . 3)? Walk the entire input list to decide whether it's a proper list or not, and switch behaviour? Or just serialize '(1 2 . 3) the same as '(1 2 3)?
If you represent your data as lists or cons trees, I'd recommend that you use a custom serialization function instead of trying to guess the actual type of the cons that is being serialized.
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.This is because
(defmethod encode ((object list) ..)
treats "pure cons" as lists too,which seems to be a "feature" of common lisp.
Solutions:
The text was updated successfully, but these errors were encountered: