โ05-29-2023 04:42 PM
Hello All,
In my use case, I have a nested JSON as an input, I want to do some transformation before I create a nested JSON which I am going to post it in a REST API,
InPut JSON:
[
{
โCustomerโ: {
โNameโ: Sam
โCityโ: โChicagoโ,
โEmail":""abc@ggg.comโ
โaccountsโ: [
{
โaccountIdโ: 3567361088,
โaccountBalanceโ: 9453.563,
โcreatedโ: โ2014-09-21โ
},
{
โaccountIdโ: 12345,
โaccountBalanceโ: 9444.563,
โcreatedโ: โ2014-09-21โ
}
]
}
}
]
Output JSON:
[
{
โCustomer_Entryโ: {
โNameโ: Sam
โaccounts_detailsโ: [
{
โacc_Idโ: 3567361088,
โacc_Balanceโ: 9453.563,
},
{
โacc_Idโ: 12345,
โacc_Balanceโ: 9444.563,
}
]
}
}
]
The challenge is after the transformation, I retain few keys including the nested keys and also renamed them into different values. Whatโs the best way to design the pipeline for this case.
Thanks in Advance.
Solved! Go to Solution.
โ05-30-2023 01:08 AM
Hello and welcome @Senthilnaga91,
You can achieve the needed transformations by using two Mapper Snaps like in the picture below.
In the first Mapper weโre mapping the Account Details array:
And, in the second one weโre mapping the Customer Entry object:
Also you can refer to the sample pipeline attached below.
sl-comm-nested-json-api_2023_05_30.slp (5.5 KB)
Let me know if this helps you.
Regards,
Aleksandar.
โ05-30-2023 01:08 AM
Hello and welcome @Senthilnaga91,
You can achieve the needed transformations by using two Mapper Snaps like in the picture below.
In the first Mapper weโre mapping the Account Details array:
And, in the second one weโre mapping the Customer Entry object:
Also you can refer to the sample pipeline attached below.
sl-comm-nested-json-api_2023_05_30.slp (5.5 KB)
Let me know if this helps you.
Regards,
Aleksandar.
โ05-30-2023 10:13 AM
It worked, Thank you @AleksandarAngelevski !