I have 2 lists:
>> a = [u'username', u'first name', u'last name']
>> b = [[u'user1', u'Jack', u'Dawson'], [u'user2', u'Roger', u'Federer']]
I am trying to get json output as follows:
[
{
"username":"user1",
"first name":"Jack",
"last name":"Dawson"
},
{
"username":"user2",
"first name":"Roger",
"last name":"Federer"
}
]
I am trying to use the zip command as follows:
>> x = []
>> for i in range(0, len(b)):
.. x += zip(a,b[i])
..
But that was not my desired outcome. How to implement this?
source
share