У меня есть список productFeatures
внутри массива продуктов.
Мне нужно создать список продуктов для каждой функции в массиве productFeatures
.
В настоящее время я использую Dataweave 2.0 длядобиться этого преобразования.
Пытался использовать map()
paylaod.pricingPlan.productFeatures
, но возвращает полный список productFeatures.Мне нужно иметь родительские данные для каждого списка.
Ввод:
[
{
"parentKey": "cars",
"key": "com.automotive.cars.wheels",
"description": "descirption for cars",
"productType": "parts",
"billingType": "PERPETUAL",
"pricingPlanModel": true,
"addOn": true,
"monthlyPricingPlan": null,
"annualPricingPlan": {
"pricingPlanId": 3098756839,
"pricingPlanUuid": "0c99989e-9877-9845-4357-7655ab821654",
"billingPeriod": "Annual",
"productKey": "com.automotive.cars.wheels.black",
"productDescription": "product descirptions for wheels",
"productFeatures": [
{
"featureKey": "feature1",
"featureDescription": "featureDescription1",
"unitPricingPolicy": "TIERED",
"unitCountLimit": 10,
"amount": 10,
"otherCurrencyAmounts": {},
"featureLabel": "featureLabel",
"licenseFeatureLabel": "featureLicenser"
}
]
},
"productDescriptionWithVendorName": "Issue for wheels"
},
{
"parentKey": "bike",
"key": "com.automotive.cars.bike",
"description": "descirption for bike",
"productType": "parts",
"billingType": "PERPETUAL",
"pricingPlanModel": true,
"addOn": true,
"monthlyPricingPlan": null,
"annualPricingPlan": {
"pricingPlanId": 3098762339,
"pricingPlanUuid": "0c99989e-9877-9845-4357-7655a0981654",
"billingPeriod": "Annual",
"productKey": "com.automotive.cars.bike.black",
"productDescription": "product descirptions for bike",
"productFeatures": [
{
"featureKey": "feature2",
"featureDescription": "featureDescription2",
"unitPricingPolicy": "TIERED",
"unitCountLimit": 20,
"amount": 20,
"otherCurrencyAmounts": {},
"featureLabel": "featureLabel2",
"licenseFeatureLabel": "featureLicenser2"
},
{
"featureKey": "feature3",
"featureDescription": "featureDescription3",
"unitPricingPolicy": "TIERED",
"unitCountLimit": 30,
"amount": 30,
"otherCurrencyAmounts": {},
"featureLabel": "featureLabel3",
"licenseFeatureLabel": "featureLicenser3"
}
]
},
"productDescriptionWithVendorName": "Issue for bike"
}
]
Ввод:
[
{
Parent: "cars",
Key:"com.automotive.cars",
PlanId:3098756839,
"featureKey": "feature1",
"featureDescription": "featureDescription1",
"unitCountLimit": 10,
"amount": 10,
"productDescription": "Issue for wheels"
},
{
Parent: "cycle",
Key:"com.automotive.cycle",
PlanId:3098756840,
"featureKey": "feature2”,
"featureDescription": "featureDescription2”,
"unitCountLimit": 20,
"amount": 20,
"productDescription": "Issue for cycle"
},
{
Parent: "cycle",
Key:"com.automotive.cycle",
PlanId:3098756840,
"featureKey": "feature3”,
"featureDescription": "featureDescription3”,
"unitCountLimit": 30,
"amount": 30,
"productDescription": "Issue for cycle"
},
{
Parent: "cycle",
Key:"com.automotive.cycle",
PlanId:3098756840,
"featureKey": "feature2”,
"featureDescription": "featureDescription4”,
"unitCountLimit": 40,
"amount": 40,
"productDescription": "Issue for cycle"
}
]