I have got a JSON serialized NSDictionary with a structure like:
key1_1 = ( //Array of dictionaries
{ //dict 1
key2_1 = val2_1
key2_2 = @"TO_BE_REPLACED"
key2_3 = ( //Another array of dictionaries
{ //dict
key2_3_1 = val2_3_1
key2_3_2 = @"TO_BE_REPLACED"
...
},
... //more dicts
)
},
... //more dicts
),
key1_2 = ...
So its basically got a complex structure of arrays and dictionaries. At any level I may encounter a "TO_BE_REPLACED" string which needs to replaced by a different string. Please note that the keys will be different.
I am able to navigate the structure successfully using recursion. But my problem is that a NSDictionary cannot be modified while its being iterated over.
What are the possible solutions to this kind of problem?