I'm pretty new to Python & JSON, I've been trying to convert a JSON response into a simple one dimension list including a dict for every occurrences of this list
The JSON format is the following :
{"key": [
{
"key1": value1,
"key2": value2,
"keyN": valueN,
},
{
"key1": value1,
"key2": value2,
"keyN": valueN,
},
{
"key1": value1,
"key2": value2,
"keyN": valueN,
}
]
}
I get this JSON from this type of function:
import json
import urllib2
t = json.load(urllib2.urlopen(path/to/JSON))
My goal is to get rid of the "first level dict" to only keep the list with every dict in it, but when I try the following :
ef = list()
ef = t.values()
I end up with unwanted character such as :
print ef
[[{u'key1': True, u'key2': u'value2', u'key3': 6},
{u'key1': True, u'key2': u'value2', u'key3': 8}
...
]]
without mentionning that I didn't do what I wanted (having only one list), but instead, I've a "list of a list". I guess that the "unwanted character" comes from a charset issue (not sure), JSON comes in utf-8