I am trying to convert one json payload to another, I have tried using DataMapper
but the output payload does not match the input payload so I can't map both data.
I tried with enrich mediator but I can't seem to find my way through.
input json
{
"requestID": "10001",
"requestMode": "mode34",
"channelCode": "34",
"agentBusinessName": "34",
"agentNumber": "34",
"agentInstitutionCode": "001",
"agentAccountNumber": "098788"
}
output json
{
"BalanceEnquiryRequest": {
"channel": null,
"type": "mode34",
"customerId": "098788",
"customerIdType": null,
"submissionTime": null,
"reqTranId": "10001",
"passcode": null
}
}
If it is just a single BalanceEnquiryRequest you can use the PayloadFactory mediator.
<payloadFactory media-type="json">
<format>
{
"BalanceEnquiryRequest": {
"channel": null,
"type": $1,
"customerId": $2,
... etc
}
}
</format>
<args>
<arg evaluator="json" expression="$.requestMode"/>
<arg evaluator="json" expression="$.agentAccountNumber"/>
... etc
</args>
<payloadFactory>