admin管理员组文章数量:1418380
For this policies section in input json i need output json like this.
if "policyType": "CancellationPolicy" in input json, then in output json cancellationPolicy block will come like this.
"cancellationPolicy": {
"penalty":{
"cancellationFee": "100"
},
"deadline":{
"numberOfDays": 30,
"type": "AtBookingTime"
}
}
and if "policyType": "DepositPolicy" in input json, then in output json, DepositPolicy block will come like this. "DepositPolicy": { "numberOfNights": 30 }
Please help me with the jolt spec.
mapping are like this:
Penalty.monetaryAmount in input will be loaded to policies.cancellationPolicy.penalty.cancellationFee in output
Deadline.numberofDays in input will be loaded to policies.cancellationPolicy.deadline.numberOfDays in output
deadline.numberofDays in input will be loaded to policies.depositPolicy.numberOfNights.
and among all the "DepositPolicy" nodes in input json only minimum value of "numberOfNights" one should appear in output.
input json :
{
"policies": [
{
"policyType": "CancellationPolicy",
"level": "Pickup",
"penalty": {
"nightBasedAmount": "EqualToDeposit",
"monetaryAmount": "100"
},
"deadline": {
"type": "AtBookingTime",
"numberOfDays": 30
}
},
{
"policyType": "DepositPolicy",
"level": "Pickup",
"deadline": {
"numberOfDays": 12
}
},
{
"policyType": "DepositPolicy",
"level": "Group",
"penalty": {
"monetaryAmount": "100",
"currency": "VND"
},
"deadline": {
"numberOfDays": 30
}
},
{
"policyType": "DepositPolicy",
"level": "Group",
"penalty": {
"monetaryAmount": "100",
"currency": "VND"
},
"deadline": {
"numberOfDays": 20
}
},
{
"policyType": "DepositPolicy",
"level": "Group",
"penalty": {
"monetaryAmount": "100",
"currency": "VND"
},
"deadline": {
"numberOfDays": 10
}
}
]
}
output josn:
{
"policies": {
"cancellationTime": "18:00:00",
"isGuaranteeRequired": true,
"cancellationPolicy": {
"penalty": {
"cancellationFee": "100"
},
"deadline": {
"numberOfDays": 30,
"type": "AtBookingTime"
}
},
"DepositPolicy": {
"numberOfNights": 10
}
}
}
本文标签: jsonNeed jolt spec for condition based scenarioStack Overflow
版权声明:本文标题:json - Need jolt spec for condition based scenario - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745288382a2651641.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论