I have the following array which is the result of some DB and domain operations. I need to transform it into a different format (given below) but can\'t do it. I have tried