I have a nested dictionary in which a deep node is an array. When I attempt to append an element to the array element of the dictionary I get a compile error. What I am trying is to replace the
["000" : "OK"]
if the key is the same "000" or append to the existing elements if the key is different such as in
["001" : "Good"]
. Appreciate some guidance or alternate method to update. The error I get is:
Cannot use mutating member on immutable value of type '[[String : String]]'
B = [ "EA" : [ "status": [["000": "OK"]]]]
B["EA"]?["status"] = [["000": "NOT OK"]]
print(B)
(B["EA"]?["status"])?.append(["001":"Good"])