Best way to format JSON data into valid array?
Clash Royale CLAN TAG #URR8PPP Best way to format JSON data into valid array? I've been given some data (random example shown below) and I would like to format it into the following (with different example to random example but same format): EDIT: Details: the "total_sales" for each top level "key", so "car" at "2018-07-20" would have "3850" and "phone" would have "4678". The numbers in both format and example do not represent each other. export const formatted = [ {date: "19/6/18", car: 60, phone: 30}, {date: "20/6/18", car: 36, phone: 40}, {date: "21/6/18", car: 34, phone: 81}, {date: "22/6/18", car: 27, phone: 30}, {date: "23/6/18", car: 24, phone: 23}, {date: "24/6/18", car: 73, phone: 10}, {date: "25/6/18", car: 23, phone: 70}, {date: "26/6/18", car: 27, phone: 65}, {date: "27/6/18", ...