I have the below JSON structure which I am trying to convert to a structure with each element as column as shown below using Spark SQL. Explode(control) is not working. Can someone please suggest a way to do this?
Input:
{
"control" : [
{
"controlIndex": 0,
"customerValue": 100.0,
"guid": "abcd",
"defaultValue": 50.0,
"type": "discrete"
},
{
"controlIndex": 1,
"customerValue": 50.0,
"guid": "pqrs",
"defaultValue": 50.0,
"type": "discrete"
}
]
}
Desired output:
controlIndex customerValue guid defaultValult type
0 100.0 abcd 50.0 discrete
1 50.0 pqrs 50.0 discrete