Just wondering if this is possible... I have a JSON array with 100 or so objects. Each object contains these key values. Job Number, Tax Amount, Line Total, and Line Total plus Tax. What I need to accomplish is creating a new JSON array with these key values. Job Number , Total Tax Amount, Sum of Tax Items, and Sum of non tax items. I only show an example of one job number, but there would be multiple Job Numbers.
[
{
"Job Number":200,
"Tax Amount":5.00,
"LineTotal":12,
"Line Total plus tax":17.00
},
{
"Job Number":200,
"Tax Amount":2.00,
"LineTotal":10,
"Line Total plus tax":12.00
},
{
"Job Number":200,
"Tax Amount":0.00,
"LineTotal":8,
"Line Total plus tax":8
}
]
I need to be able to look at all matching job numbers and sum the value of the other keys for that job number. One other twist... Sum of Tax Items only sums the values of items that have a tax amount and Sum of non tax items only sums the values of items with no tax amount. So the desired output would look like this...
[
{
"Job Number":200,
"Total Tax Amount":7.00,
"Sum of Tax Items":22.00,
"Sum of non tax items":8
}
]
I have a basic understanding on how to manipulate arrays, but this is something I haven't encountered before and not sure if this possible.
Thanks