I am working with an array of objects that looks like this:
[{
"Germany": "text",
"Brazil": "50.00"
}, {
"Germany": "1000.00",
"Brazil": "1100.00"
}, {
"Germany": "999999999",
"Brazil": "9999999",
"France": "12"
}]
My goal is to transform it into the following structure:
[{
"name": "Germany",
"value": 999999999
}, {
"name": "Brazil",
"value": 999999999
}, {
"name": "France",
"value": 12
}]
In this new structure, for each key in the first object, I want to use the higher value among all the objects.
Note: If a value is text (e.g.,
"Germany": "text"
), it should be ignored. This case has been added in the example above.