I have dataframe which is product of left join. Now I want to create json structure.
I tried using different option but I was not able create it. Here is my dataframe :
col1 col2 col3 col4
1111 name aaa bbb
1111 name ccc ddd
1111 name iii kkk
1112 name1 abcd def
1112 name1 DEFG ABXC
The desired json structure is:
{col1: 1111, col2: name, details: [{col3: aaa, col4: bbb}, {col3: ccc, col4: ddd}, {col3: iii, col4: kkk}]},
{col1: 1112, col2: name1, details: [{col3: abcd, col4: def}, {col3: DEFG, col4: ABXC}]}