(defun collect-alist-from-tree (tree key)
(let ((collection))
(defun look (tree)
(cond-let*
([item (and (json-alist-p tree)
(assq key tree))]
(push item collection))
((proper-list-p tree)
(mapcar #'look tree)))))
collection)

I have a very nested tree, and I want to get a list of all the places there is a alist with key.

Is there a better way to do this?

#emacslisp #emacs

@tusharhero immediately i notice that you should use cl-labels/cl-flet instead of a defun since defun is global
@tusharhero also i notice that let closes before the return of its localvar, and that look isnt called in that snippet