我正在尝试使用jolt转换实现if-else条件以获得预期的输出,任何人都可以帮助我:
注意事项:
1.如果**billentity
等于AWS Marketplace
**
则**PriceToCustomer
将等于0**
1.否则如果**billentity
等于AWS
**
则如果**LineItemType
等于RecurringFee
**
则**unblendedCost
值将等于PriceToCustomer
**
elseif**LineItemType
等于tax
**
则**(unblendedCost value * tax value/100) + 1
等于PriceToCustomer
**
否则**LineItemType
等于Usage
**
则**(unblendedCost value * Usage value/100) + 1
将等于PriceToCustomer
**
输入:
[
{
"billentity": "AWS Marketplace",
"lineItemType": "tax",
"unblendedCost": 10,
"tax": 5.02
},
{
"billentity": "AWS",
"lineItemType": "tax",
"unblendedCost": 10,
"tax": 8.02
},
{
"billentity": "AWS",
"lineItemType": "Usage",
"unblendedCost": 10,
"Usage": 9.02
}
]
字符串
预期输出:
[
{
"billentity": "AWS Marketplace",
"lineItemType": "tax",
"unblendedCost": 10,
"tax": 5.02,
"PriceToCustomer": 0
},
{
"billentity": "AWS",
"lineItemType": "tax",
"unblendedCost": 10,
"tax": 8.02,
"PriceToCustomer": 1.802
},
{
"billentity": "AWS",
"lineItemType": "Usage",
"unblendedCost": 10,
"Usage": 9.02,
"PriceToCustomer": 1.902
}
]
型
1条答案
按热度按时间bxfogqkk1#
可以在shift转换中使用条件逻辑,在modify转换中使用计算,例如
字符串
网站http://jolt-demo.appspot.com/上的 * 演示 * 是:
的数据