I have a nested json that looks like this:
[
{
'Name':'Anders',
'Type':'Hunter',
'Race':'Cyborg',
},
{
'Name':'Karin',
'Type':'Titan',
'Race':'Human',
},
{
'Name':'Jenny',
'Type':'Warlock',
'Race':'Marsian',
},
]
And I have a string that looks like this:
['1', 'Ham', 'Spam', 'Bacon', '1', 'Ham', 'Cucumber', 'Tomato', '1', 'Wood', 'Potato', 'Herring']
I want to insert the string into the json with a name for the value. Each four in the string is for each person in the json.
Final result should look like this:
[
{
'Name':'Anders',
'Type':'Hunter',
'Race':'Cyborg',
'string1':'1',
'Food_1':'Ham',
'Food_2':'Spam',
'Food_3':'Bacon',
},
{
'Name':'Karin',
'Type':'Titan',
'Race':'Human',
'string1':'1',
'Food_1':'Ham',
'Food_2':'Cucumber',
'Food_3':'Tomato',
},
{
'Name':'Jenny',
'Type':'Warlock',
'Race':'Marsian',
'string1':'1',
'Food_1':'Wood',
'Food_2':'Potato',
'Food_3':'Herring',
},
]
I have tryied with some iterations, but fails all the time :/
Hope you can help me!