Retrieve the values associated to a member name in a JSON object.
(object-member-values name object) → values
As mentioned in values, our model of JSON values does not assume or enforce that JSON objects have members with unique names. Accordingly, given a member name, there may be 0, 1, or more values associated with that name. This function returns the list of such values, in the order in which they occur in the object; member order is captured and significant in our JSON values.
Note that if the JSON object has two duplicate members (meaning not just the same name, but also the same value), the list returned here has correspondingly duplicate values.
Function:
(defun object-member-values-aux (name members) (declare (xargs :guard (and (stringp name) (member-listp members)))) (let ((__function__ 'object-member-values-aux)) (declare (ignorable __function__)) (cond ((endp members) nil) ((equal name (member->name (car members))) (cons (member->value (car members)) (object-member-values-aux name (cdr members)))) (t (object-member-values-aux name (cdr members))))))
Theorem:
(defthm value-listp-of-object-member-values-aux (b* ((values (object-member-values-aux name members))) (value-listp values)) :rule-classes :rewrite)
Function:
(defun object-member-values (name object) (declare (xargs :guard (and (stringp name) (valuep object)))) (declare (xargs :guard (value-case object :object))) (let ((__function__ 'object-member-values)) (declare (ignorable __function__)) (object-member-values-aux name (value-object->members object))))
Theorem:
(defthm value-listp-of-object-member-values (b* ((values (object-member-values name object))) (value-listp values)) :rule-classes :rewrite)