Q:

Looking for a key in a nested dict to change the type of the key

I have a dict like this one:
exampleDict={'name': 'Example1', 'code': 2, 'price': 23, 'dimensions': [2,2]}

And I want to change the type of dimensionsto a string, like this: 
exampleDict['dimensions'] = str(dict['dimensions'])

This works just fine. But imagine there are nested dicts inside my exampleDict, and dimensionsis a bit far inside. 
My guess is to do something recursively. From what I have searched in here, (examples like this one, or this one, they use yieldin a recursive function, but I am not sure why it's used. 
I was thinking on doing this:
def changeToStringDim(d):
    if 'dimensions' in d:
        d['dimensiones'] = str(d['dimensions'])
    for k in d:
        if isinstance(d[k], list):
            for i in d[k]:
                for j in changeToStringDim(i):
                    j[dimensions] = str(j['dimensions'])

I found it in here, but instead of the assignment of j[dimensions]=str(j['dimensions']) it did a yield.But I adapted the solution to this, and it works fine in a dict like this example. 
Now I am trying to do it in a nested one. 
exDict2={'name': 'example1',
         'nesting': {'subnesting1': 'sub2',
                     'coordinates': [41.6769705, 2.288154]},
         'price': 123123132}
         }

With the same function but changing it to coordinates:
def changeToStringCoord(d):
    if 'coordinates' in d:
        d['coordinates'] = str(d['coordinates'])
    for k in d:
        if isinstance(d[k], list):
            for i in d[k]:
                for j in changeToStringDim(i):
                    j['coordinates'] = str(j['coordinates'])

And it won't do anything. I have debugged it, and it will just go through name, nestingand  price. The isinstanceis not working properly (or it is and I am not fully understanding its methodology). 

A:

Code with comments:
def changeNestedListToString(d):
    for k in d:

        # recursive call on dictionary type
        if isinstance(d[k], dict):
            changeNestedListToString(d[k])

        # convert lists to string
        elif isinstance(d[k], list):
            d[k] = str(d[k])

        # leave everything else untouched

Test data:
example = {
    'name': 'example1',
    'nesting': {
        'subnesting1': 'sub2',
        'coordinates': [41.6769705, 2.288154]
    },
    'price': 123123132
}

After calling the function:
{
    'price': 123123132, 
    'name': 'example1', 
    'nesting': {
         'coordinates': '[41.6769705, 2.288154]', 
         'subnesting1': 'sub2'
    }
}

As you can see 'coordinates' has been converted to a string while everything else was left untouched.

