Reputation: 149
("person"
("child-1"
("grandchild-1a" "grandchild-1a-value"
"grandchild-1b" "grandchild-1b-value")
"child-2"
("grandchild-2a" "grandchild-2a-value"
"grandchild-2b" "grandchild-2b-value")))
How can "grandchild-1b-value"
be modified to "grandchild-1b-value-modified"
? The keys are strings.
Or how can I make a new var that is an equivalent nested plist except for the new value?
Below is how I ended up with the plist. I fed the response from a drakma request to yason:parse
:
(let ((stream (drakma:http-request endpoint
:method :post
:want-stream t
:content-type "application/json"
:content request)))
(setf (flexi-streams:flexi-stream-external-format stream) :utf-8)
(let ((response (yason:parse stream :object-as :plist)))
***HERE***))
Upvotes: 0
Views: 59
Reputation: 139381
CL-USER 346 > (pprint
(subst "grandchild-1b-value-modified"
"grandchild-1b-value"
'("person"
("child-1"
("grandchild-1a" "grandchild-1a-value"
"grandchild-1b" "grandchild-1b-value")
"child-2"
("grandchild-2a" "grandchild-2a-value"
"grandchild-2b" "grandchild-2b-value")))
:test #'equal))
("person"
("child-1"
("grandchild-1a"
"grandchild-1a-value"
"grandchild-1b"
"grandchild-1b-value-modified")
"child-2"
("grandchild-2a"
"grandchild-2a-value"
"grandchild-2b"
"grandchild-2b-value")))
Upvotes: 2