Error:class java.util.ArrayList cannot be cast to class java.sql.Array
Hello ,
I am facing following issue while inserting data into postgres database from json file.
Error : class java.util.ArrayList cannot be cast to class java.sql.Array (java.util.ArrayList is in module java.base of loader ‘bootstrap’; java.sql.Array is in module java.sql of loader ‘platform’).
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!