Forum Discussion

GanguP's avatar
GanguP
New Contributor III
2 years ago
Solved

Extract or Flatten JSON Array data as columns

Need help in to pulling data from the below JSON and also from the Array (Tags) below.   I also went through the documentation but unable to get to the solution.     "entity": { "totalRecords"...
  • koryknick's avatar
    2 years ago

    vgautam64 - I believe this solves your question in the simplest way I can think of.  Use a Mapper snap with the following configuration:

    It appears to me that you only need the field elements and values from the first group element: $group[0]

    The two jsonPath statements are simply pulling all values for the Debit and Credit Amounts into an array of numbers

    Finally, the Array.reduce() method is used to aggregate that list of numbers into a final total.

    Hope this helps!