In my column with json data, I have this list I want to extract to column:
"list":[
{
"id":"list",
"item":[
{
"value":"Hergestellt in Italien aus 100% reinem Platin-Flüssigsilikon"
},
{
"value":"Geruchs- und geschmacksneutral"
},
{
"value":"Kältebeständig bis -60°C"
},
{
"value":"Inklusive Rezeptbuch und 50 Eisstielen"
},
{
"value":"spülmaschinengeeignet"
}
],
"decorators":[
]
},
I have extracted other data using this code but the value was string and not a dictionary:
if 'item' in item and item['item']:
if isinstance(item['item'], str):
cur_model_info[item['id']] = item['item']
elif isinstance(item['item'], list):
elements = [element['value'] for element in item['item']]
cur_model_info[item['id']] = ','.join(elements)
I tried to use this for the above format of data but I got this error: TypeError: sequence item 0: expected str instance, dict found
What should I change in order to be able to export in a separate column the data having each element from the list in a new cell of that column?
expected output
Using the above code, the data is exported in this format