Looking to parse through this JSON 2D array (snapshot data example below) to calculate the total cases and deaths for each date, disregarding the state column. While achievable in SQL, it poses a challenge in JavaScript.
Ultimately, the summarized data will resemble:
The JSON 2D array will take the following form:
{date: "2020-02-17", totalCases: "7", totalDeaths: "1"}
{date: "2020-02-18", totalCases: "150", totalDeaths: "2"}
{date: "2020-02-19", totalCases: "210", totalDeaths: "3"}
{date: "2020-02-20", totalCases: "350", totalDeaths: "7"}
The original JSON object to aggregate is shown below
138: {date: "2020-02-18", state: "California", fips: "06", cases: "7", deaths: "0"}
139: {date: "2020-02-18", state: "Illinois", fips: "17", cases: "2", deaths: "0"}
140: {date: "2020-02-18", state: "Massachusetts", fips: "25", cases: "1", deaths: "0"}
141: {date: "2020-02-18", state: "Nebraska", fips: "31", cases: "10", deaths: "0"}
142: {date: "2020-02-18", state: "Texas", fips: "48", cases: "2", deaths: "0"}
143: {date: "2020-02-18", state: "Washington", fips: "53", cases: "1", deaths: "0"}
144: {date: "2020-02-18", state: "Wisconsin", fips: "55", cases: "1", deaths: "0"}
145: {date: "2020-02-19", state: "Arizona", fips: "04", cases: "1", deaths: "0"}
146: {date: "2020-02-19", state: "California", fips: "06", cases: "7", deaths: "0"}
147: {date: "2020-02-19", state: "Illinois", fips: "17", cases: "2", deaths: "0"}
148: {date: "2020-02-19", state: "Massachusetts", fips: "25", cases: "1", deaths: "0"}
149: {date: "2020-02-19", state: "Nebraska", fips: "31", cases: "10", deaths: "0"}
150: {date: "2020-02-19", state: "Texas", fips: "48", cases: "2", deaths: "0"}
151: {date: "2020-02-19", state: "Washington", fips: "53", cases: "1", deaths: "0"}
152: {date: "2020-02-19", state: "Wisconsin", fips: "55", cases: "1", deaths: "0"}
153: {date: "2020-02-20", state: "Arizona", fips: "04", cases: "1", deaths: "0"}
154: {date: "2020-02-20", state: "California", fips: "06", cases: "8", deaths: "0"}
155: {date: "2020-02-20", state: "Illinois", fips: "17", cases: "2", deaths: "0"}
156: {date: "2020-02-20", state: "Massachusetts", fips: "25", cases: "1", deaths: "0"}
157: {date: "2020-02-20", state: "Nebraska", fips: "31", cases: "11", deaths: "0"}