如何使用Spark中的数据框从嵌套JSON中选择数据。 从下面的示例JSON中,我想从Array中的Array中选择数据。
"xyz01": [
{
"@SEGMENT": "1",
"POS": "00001",
"MEN": "10.000",
"xyz05": [
{
"CHL": "DIRECT",
"BET": "54545"
},
{
"@SEGMENT": "1",
"CHL": "INDIRECT",
"TRG": "778787",
}
]
},
{
"@SEGMENT": "1",
"POS": "00002",
"MENGE": "4354354",
"xyz05": [
{
"@SEGMENT": "1",
"ALCKZ": "+",
"CHL": "DIRECT",
},
{
"@SEGMENT": "1",
"CHL": "INDIRECT",
"TRG": "3434343"
}
]
};
]
必需的输出。
POS CHL
000001直接
000001间接
000002直接
000002间接