Need a jolt spec where body.Contract.stayRestrictions[].restrictionType="ClosedToArrival"
populate body.Block.stayRestrictions[].isClosedToArrival=true
else populate false
input JSON :
{
"body": {
"Contract": {
"stayRestrictions": [
{
"restrictionType": "ClosedToArrival"
}
]
}
}
}
output JSON:
{
"body": {
"Block": {
"stayRestriction": [
{
"isClosedToArrival": "true"
}
]
}
}
}
Need a jolt spec where body.Contract.stayRestrictions[].restrictionType="ClosedToArrival"
populate body.Block.stayRestrictions[].isClosedToArrival=true
else populate false
input JSON :
{
"body": {
"Contract": {
"stayRestrictions": [
{
"restrictionType": "ClosedToArrival"
}
]
}
}
}
output JSON:
{
"body": {
"Block": {
"stayRestriction": [
{
"isClosedToArrival": "true"
}
]
}
}
}
Share
Improve this question
edited Feb 6 at 16:24
Barbaros Özhan
65.3k11 gold badges36 silver badges61 bronze badges
asked Feb 6 at 15:57
OptimizerOptimizer
2611 gold badge2 silver badges10 bronze badges
1 Answer
Reset to default 2You can use the conditional logic under "restrictionType"
object within the following spec such as
[
{
"operation": "shift",
"spec": {
"body": {
"Contract": {
"stayRestrictions": {
"*": {
"restrictionType": {
"ClosedToArrival": {
"#true": "&6.&5.&4[&3].is&1"
},
"*": {//else case
"#false": "&6.&5.&4[&3].is&1"
}
}
}
}
}
}
}
}
]