I've a druid cluster that I'm querying with the plywood library.
Data are retrieved as arrays of objects. Everything is fine, but now I've now to reshape those data to have a better visualization in my table.
This is my array:
var x_start = [
{ split: 'no', c1: 345, c2: 763, c3: 12 },
{ split: 'yes', c1: 293, c2: 1283, c3: 46 },
];
x_start will always have 2 object with the same keys.
And this is what i want to accomplish:
var x_target = [
{ cluster: 'c1', no: 345, yes: 293 },
{ cluster: 'c2', no: 763, yes: 1283 },
{ cluster: 'c3', no: 12, yes: 46 },
];
I made some researches and I understand that the best solution is probably to use a combination of map for accessing the objects and then reshaping them, but I'm in trouble to find the correct way to do that.
Any suggestion?