Reputation: 145
I have some values in a column that looks like this:
{"template":{"module":[{"id":"module-12","header":[{"id":"title","value":"Cycle in Comfort","decorators":[]}],"paragraph":[{"id":"description","value":["This folding exercise bike features a heavily-padded seat and backrest for your comfort."]
Is there any way I can extract information from it and paste it in other columns? Information that need to be extracted:
module-12
Cycle in Comfort
This folding exercise bike features a heavily-padded seat and backrest for your comfort
Any advice on extracting the needed information?
Upvotes: 0
Views: 38
Reputation: 5745
assuming your dictionary object name mydict
:
item = mydict["template"]['module'][0]
module_12 = item['id']
header = item['header'][0]
cycle = header['value']
paragraph = item['paragraph'][0]
text = paragraph['value']
print(module_12)
>>> module-12
print(module_12)
>>> Cycle in Comfort
print(module_12)
>>> This folding exercise bike features a heavily-padded seat and backrest for your comfort
Upvotes: 1