Forum Discussion

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

Reduce an array of objects into a single object with the sum of fields as the result

I have an array of the following form: I want to convert this array of objects into a single object that has the same fields along with Debit_Amount and Credit_Amount fields summed up. ...
  • GanguP's avatar
    GanguP
    2 years ago

    This worked perfectly fine. I do have questions though,
    1) will this methodology work for multiple tags(arrays)?
    2) Adding the second JSON splitter makes it easier,  I did provide a small number of columns in the sample but it has lot morefields. If we have to add 100's of fields it becomes tedious.  Is there another option or an easier way to do this?

     



  • koryknick's avatar
    2 years ago

    GanguP - rather than specify the individual columns to retain, you can select the "Include scalar parents" checkbox.  As long as the element is a primitive datatype (i.e. not array or object), it will automatically let it pass through.