I have one dictionary that contains an Array of Dictionaries.
\"other\":(
{
\"grocery_section\" = other,
name = test
},
{
Enumerate the outer dictionary and get the indices with filter
var filteredDict = [String:[Int]]()
for (key, value) in dict {
let indices = value.indices.filter{ value[$0]["name"] == "test" }
if !indices.isEmpty { filteredDict[key] = indices }
}
The result is a [String:[Int]] dictionary, the keys are the dictionary keys, the values are the indices.
With the given data the result is ["c0f5d6c5-4366-d310c0c9942c": [1], "other": [0]]
If you want to update an item you have to specify the entire path due to value semantics
list[key]![index]["propertyName"] = value