I am looking to convert json with array, to array of jsons with key value pairs.
Below is the format I have. The index zero has three array of list with different values in it. The values of index zero should be represented in one single array with different json for each list as key value pair as shown below.
Example
{'0': ['ID:123,qty:2,name:zbc',
'ID:234,qty:3,name:xyz',
'ID:456,qty:6,name:opq']}
to be converted to
[{"ID":"123","qty":"2","name":"zbc"},{"ID":"234","qty":"3","name":"xyz"}{"ID":"456","qty":"6","name":"opq"}]
The whole data looks like below
{'0': ['ID:123,qty:2,name:zbc',
'ID:234,qty:3,name:xyz',
'ID:456,qty:6,name:opq']
'1':['ID:666,qty:2,name:ppp',
'ID:322,qty:5,name:uuu'],
'2' : ['ID:333,qty:3,name:pqr',
'ID:444,qty:5,name:mmm',
'ID:555,qty:6,name:iii']
}
Convert to as below:
[{"ID":"123","qty":"2","name":"zbc"},
{"ID":"234","qty":"3","name":"xyz"},
{"ID":"456","qty":"6","name":"opq"}]
[{"ID":"666","qty":"2","name":"ppp"},
{"ID":"322","qty":"5","name":"uuu"}]
[ {"ID":"333","qty":"3","name":"pqr"},
{"ID":"444","qty":"5","name":"mmm"},
{"ID":"555","qty":"6","name":"iii"}]
Please help here.
['ID:123,qty:2,name:zbc', ['ID:234,qty:3,name:xyz', ['ID:456,qty:6,name:opq']? 3 opening brackets, but only 1 closing bracket? This isn't even valid Python syntax.[{...}, {...} {...}] [{...} {...}] [{...} {...} {...}]. What is this? List of lists? Or 3 different lists? Commas aren't event present to mark separation between elements.