У меня есть JSON, как показано ниже
{
"packages": [
{
"screenings": [
{
"data": {
"educationHistory": [
{
"school": "Test education 4"
},
{
"school": "Test education 4"
}
]
}
},
{
"data": {
"educationHistory": [
{
"major": [
"Business Admin."
],
"school": "Test education 1"
},
{
"major": [
"Business Admin."
],
"school": "Test education 1"
}
]
}
}
]
}
]
}
В dataweave я написал так
ns0#EmploymentHistory: {(
payload.packages[0].screenings.data.educationHistory map {
ns0#Employer: {
ns0#EmployerName: $.school
}
}
)}
Я получаю вывод, как это
<ns0:EmploymentHistory>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 4</school>
<school>Test education 4</school>
</ns0:EmployerName>
</ns0:Employer>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 1</school>
<school>Test education 1</school>
</ns0:EmployerName>
</ns0:Employer>
</ns0:EmploymentHistory>
Мне нужно, как показано ниже
<ns0:EmploymentHistory>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 4</school>
</ns0:EmployerName>
</ns0:Employer>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 4</school>
</ns0:EmployerName>
</ns0:Employer>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 1</school>
</ns0:EmployerName>
</ns0:Employer>
<ns0:Employer>
<ns0:EmployerName>
<school>Test education 1</school>
</ns0:EmployerName>
</ns0:Employer>
</ns0:EmploymentHistory>
Этот xpath payload.packages[0].screenings.data.educationHistory map {
проходит через screening
, а не educationHistory