Change json.dumps dictionary values in python
<p>So i have following dict:</p>

<pre><code>my_dict{'key1': 'value1',
        'key2': 'value2',
        'key3': json.dumps([
           {"**subkey1**": "subvalue1", "**subkey2**": "subvalue2",},
           {"**subkey1**": "other_subvalue", "**subkey2**":"other_subvalue2"}])
       }
</code></pre>

<p>What I need is to somehow made a def where i have to check and for each subkey2 to change its value only for the def itself</p>

<p>And all subkey1 to check if its value is the same like the second subkey1
Please note I am talking about only subkey1 which I have twice.</p>

<p>I don't want to set them manually. Mean I have this dict global, and calling it from many def, so i need to make these changes and check inside each def</p>

<p>What I tried is:</p>

<pre><code>def recurse_keys(my_dict, indent = ''):
    print(indent+str(key))
    if isinstance(my_dict[key], dict):
        recurse_keys(my_dict[key], indent+'   ')
recurse_keys(my_dict)
</code></pre>

<p>And for now it is only printing all of my params, but am not sure how to proceed</p>

<p>Example:</p>

<pre><code>my_dict{'name': 'georgi',
        'famili': 'ivanov',
        'drinks': json.dumps([
           {"breakfast": "milk", "lunch": "beer",},
           {"breakfast": "tea",       "lunch":"vodka"}])
def test()
    ....check if both breakfast are the same and if not make them so....(all these, mean dict and the function it self are in same file)
</code></pre>

<p>so I need to check if the values for the two breakfast are the same (without to know them) and if they are not, to make them so.</p>

<p>And also to check if there is lunch with empty value or 0 and again if not, to make it so</p>