Summing up a field from the innermost JSON node and displaying the total in the outermost node

How do we modify the formula if we have to sum up the values at 3 levels.

Tried something like {|l| l[‘amount’]}.sum and {|l||l| l[‘amount’]}.sum Both these did not work.

If the syntax could be explained that would be helpfull.