Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to add two values from a JSON response

I have an API that returns a response like:

paymentCalculations": [
    {
      "payPeriodId": "910ecdd8-cc68-46c0-817b-5c1dcd446f7e",
      "netPay": 15000,
       "currencyCode": "INR"
     },
    {
        "payPeriodId": "13be8ad4-9af6-4735-82a5-0c0ba081d873",
        "netPay": 1200,
        "currencyCode": "INR"
    }
 ]

From this API response, I want sum of netPay (TotalNetPay = 15000 + 1200 = 16200). I tried using Aggregator SUM(INT). But its accumulating up all consecutive values from next API calls as well into one..

1st API Call response: TotalNetPay = 15000 + 1200 = 16200

2st API Call response: TotalNetPay = 2000 + 300 = 2300 + 16200 = 18500

and so on..

Is there a way I can just sum up like this: 1st API Call response: TotalNetPay = 15000 + 1200 = 16200

2st API Call response: TotalNetPay = 2000 + 300 = 2300

I want result to add values from 1 API response and do not need accumulation. How can I achieve this ?