python ordered_dict from json
Question: I am using Python 2.6.6, and trying to generate a ordered_dict from json
string. I could understand that I could use object_pairs_hook of json
Decoder/loads, but unfortunately it's not supported in 2.6.6. Is there any way
out?

    
    
    e.g. 
    template_s = '{ "aa": {"_type": "T1"}, "bb": {"_type": "T11"}}'
    json.loads(template_s, object_pairs_hook=OrderedDict)
    >>> json.loads(json_str, object_pairs_hook=OrderedDict)                                                                                 
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python2.6/json/__init__.py", line 318, in loads
      return cls(encoding=encoding, **kw).decode(s)
      TypeError: __init__() got an unexpected keyword argument 'object_pairs_hook'
    

Thanks


Answer: I was able to do the same with simplejson

    
    
    import simplejson as json
    json.loads(config_str, object_pairs_hook=json.OrderedDict)
    

