Forum Discussion
rohithmadhavan
4 years agoEmployee
@manohar You can use the map Array function:
$array.map(x => Math.abs(x))
manohar
4 years agoContributor
Hi @rohithmadhavan. thanks for that.
I actually should have added my array that I want to convert. how can I apply yours to below one?
jsonPath($, “$[‘invoice-charges’][*].total”)
Thanks
Manohar
- rohithmadhavan4 years agoEmployee
Assuming
jsonPath($, “$[‘invoice-charges’][*].total”)
returns an array:jsonPath($, “$[‘invoice-charges’][*].total”).map(x => Math.abs(x))