I have a need to change the name of JSON property but only if the value of a sub-property is a specific value. In the example below I want to rename data.relationships.policyHolder
to data.relationships.companies
but only if data.relationships.policyHolder.data.type
equals "companies"
. Can jolt do something like this?
Input
{
"data": {
"type": "clients",
"id": "U5QYNSHY27CPD6DBQL2PRV6EU2BIJZ6G6STH47Q-",
"relationships": {
"policyHolder": {
"data": {
"type": "companies",
"id": "U5QYNSHY27CPD6DBQL2PRV6EU34NPSGEQKCOPRXUUZ7H4---"
}
},
"persons": {
"data": {
"type": "persons",
"id": "6H4IN45HMHCKN6MG27ZE5V6EU34NPRVD6GB6PEI-"
}
}
}
}
}
Output
{
"data": {
"type": "clients",
"id": "U5QYNSHY27CPD6DBQL2PRV6EU2BIJZ6G6STH47Q-",
"relationships": {
"companies": {
"data": {
"type": "companies",
"id": "U5QYNSHY27CPD6DBQL2PRV6EU34NPSGEQKCOPRXUUZ7H4---"
}
},
"persons": {
"data": {
"type": "persons",
"id": "6H4IN45HMHCKN6MG27ZE5V6EU34NPRVD6GB6PEI-"
}
}
}
}