I have this String (representing a JSON value):
BABEL_JSON = "{
'BD': u'Bangladesh',
'WF': u'Wallis y Futuna',
'BF': u'Burkina Faso'
}"
and I need to transform into a List object like this:
BABEL_LIST = [
("BD", u"Bangladesh"),
("WF", u"Wallis y Futuna"),
("BF", u"Burkina Faso")
]
What is the best way? to begin I tried with:
import json
BABEL_LIST = json.loads(str(BABEL_JSON))
but I have this error:
TypeError: 'NoneType' object is not callable
BABEL_JSONwas a dictionary, you could just useBABEL_JSON.items()to getBABEL_LIST.