diff --git a/backend/cl-json.lisp b/backend/cl-json.lisp index b7fbcef..611deae 100644 --- a/backend/cl-json.lisp +++ b/backend/cl-json.lisp @@ -76,8 +76,7 @@ such tokens is :SYMBOL)." `(let ((json::+json-lisp-symbol-tokens+ '(("true" . t) ("false" . nil) - ("null" . :null) - ("undefined" . :undefined))) + ("null" . :null))) (json:*object-scope-variables* '(json:*internal-decoder* *json-object-accumulator* *json-last-object-key*)) (json:*beginning-of-object-handler* #'json-object-init) (json:*object-key-handler* #'json-object-add-key) diff --git a/functions.lisp b/functions.lisp index 107026b..5d0339e 100644 --- a/functions.lisp +++ b/functions.lisp @@ -229,7 +229,6 @@ OBJECT can be JSON array or object, which in Lisp translates to (defgeneric jcopy (object) (:method ((object real)) object) (:method ((object (eql :null))) object) - (:method ((object (eql :undefined))) object) (:method ((object (eql t))) object) (:method ((object null)) object) (:method ((object string)) object) @@ -268,12 +267,12 @@ If the OBJECT is not a JSON array/object, throws `non-indexable'.")) (declare (ignore object)) t) (:method ((object symbol)) - (not (member object (list nil :null :undefined)))) + (not (member object (list nil :null)))) (:documentation "Test OBJECT for truthiness in JSON terms. -Recognize all the values true, except for null, undefined, and -false. This is to make the transition from JSON to Lisp (3+ false -values -> 1 false value) smoother. +Recognize all the values true, except for null and false. This is to +make the transition from JSON to Lisp (2 false values -> 1 false +value) smoother. Unlike JavaScript, empty strings and zero are not false (because this behavior is confusing).")) diff --git a/macros.lisp b/macros.lisp index c06a93d..12d9713 100644 --- a/macros.lisp +++ b/macros.lisp @@ -120,7 +120,7 @@ See more examples in njson tests." (bindings (list))) (labels ((parse-pattern (pattern &optional (current-path (list))) (etypecase pattern - ((or (member :true :false :null :undefined) string real) + ((or (member :true :false :null) string real) (push (cons pattern (copy-list current-path)) bindings)) ((cons symbol *) @@ -152,7 +152,7 @@ See more examples in njson tests." (cons symbol (or (cons symbol null) null)))) if (typep binding '(or array real null - (member :true :false :null :undefined))) + (member :true :false :null))) collect `(,(gensym) (check-value ,binding (vector ,@key) ,form-sym)) else if (and (symbolp binding) (uiop:emptyp key)) diff --git a/njson.lisp b/njson.lisp index fb244ea..32a68b8 100644 --- a/njson.lisp +++ b/njson.lisp @@ -39,7 +39,6 @@ FROM can be a string, stream, pathname, or byte array. Distinguishes between null/false and arrays/objects. Decodes: - null as :NULL, -- undefined as :UNDEFINED, - false as nil, - true as t, - arrays as vectors, @@ -88,5 +87,4 @@ TO can be: Distinguishes between null and false. Encodes: - :NULL as null, -- :UNDEFINED as undefined, - nil as false.")) diff --git a/tests/tests.lisp b/tests/tests.lisp index 8601193..17533e7 100644 --- a/tests/tests.lisp +++ b/tests/tests.lisp @@ -66,7 +66,6 @@ (assert-eql 8 (jcopy 8)) (assert-float-equal 1.3 (jcopy 1.3)) (assert-eq :null (jcopy :null)) - (assert-eq :undefined (jcopy :undefined)) (assert-error 'error (jcopy :whatever)) (assert-eq t (jcopy t)) (assert-false (jcopy nil)) @@ -98,7 +97,6 @@ (assert-error 'non-indexable (jget 20 nil)) (assert-error 'non-indexable (jget 20 t)) (assert-error 'non-indexable (jget 20 :null)) - (assert-error 'non-indexable (jget 20 :undefined)) (assert-error 'non-indexable (jget 20 200)) (assert-error 'non-indexable (jget 20 200.3)) (assert-error 'non-indexable (jget 20 "foo")) @@ -129,7 +127,6 @@ (assert-equalp #(t) (ensure-array t)) (assert-equalp #(nil) (ensure-array nil)) (assert-equalp #(:null) (ensure-array :null)) - (assert-equalp #(:undefined) (ensure-array :undefined)) (assert-equalp #(8) (ensure-array 8)) (assert-equalp #(1.3) (ensure-array 1.3)) (assert-equalp #(1.3 "foo") (ensure-array #(1.3 "foo")))