I'm trying to write a spec to do the below transformation using jolt transformation. I'm only interested in changing the name of key in json, value should remain same. Help me out.
Input Json:
[
{
"list1": [
{
"id": "CPP1600000009846",
"list2": [
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "CONAMP"
},
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "PCCPRI"
},
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "PCCPCI"
},
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "PCCPII"
}
]
},
{
"id": "CPP1600000009846",
"list2": [
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "CONEIT"
},
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "CONCRT"
},
{
"amount": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"code": "CONNCT"
}
]
}
]
}
]
Expected output:
[
{
"listA": [
{
"Num": "CPP1600000009846",
"listB": [
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "CONAMP"
},
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "PCCPRI"
},
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "PCCPCI"
},
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "PCCPII"
}
]
},
{
"Num": "CPP1600000009846",
"listB": [
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "CONEIT"
},
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "CONCRT"
},
{
"rate": {
"formattedPrimeAmount": "0.00",
"primeAmount": "0.00"
},
"covg_code": "CONNCT"
}
]
}
]
}
]