Encode keys of dictionaries inside a list from unicode to ascii.
I have sample response with friends list from facebook:
    
    [{u'uid': 513351886, u'name': u'Mohammed Hossein', u'pic_small': u'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs643.snc3/27383_513351886_4933_t.jpg'},
        {u'uid': 516583220, u'name': u'Sim Salabim', u'pic_small': u'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs348.snc4/41505_516583220_5681339_t.jpg'}]

How I could parse through this list encoding key's of the dictionaries to ascii ? I've tried something like this :

    response = simplejson.load(urllib.urlopen(REST_SERVER, data))
    for k in response:
        for id, stuff in k.items():
            id.encode("ascii")
            logging.debug("id: %s" % id)
    return response

But encoded keys are not saved and as a result I'm still getting unicode values.
Encode keys of dictionaries inside a list from unicode to ascii.
===

I have sample response with friends list from facebook:
    
    [{u'uid': 513351886, u'name': u'Mohammed Hossein', u'pic_small': u'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs643.snc3/27383_513351886_4933_t.jpg'},
        {u'uid': 516583220, u'name': u'Sim Salabim', u'pic_small': u'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs348.snc4/41505_516583220_5681339_t.jpg'}]

How I could parse through this list encoding key's of the dictionaries to ascii ? I've tried something like this :

    response = simplejson.load(urllib.urlopen(REST_SERVER, data))
    for k in response:
        for id, stuff in k.items():
            id.encode("ascii")
            logging.debug("id: %s" % id)
    return response

But encoded keys are not saved and as a result I'm still getting unicode values.