How to build custom json structure from array of objects in Typescript? Here is the example of the list of objects that are retrieved from database.