I need a way to reduce a array
and unify and count the matches in a% new matriz
, this is the data:
Reduce a array
of a API
, convert them to matriz
and count the names of the countries and leave only the countries without repeating and the number of times they appear repeated
datos = [{"PaisExportador": "CHINA","fila": 1},
{"PaisExportador": "URUGUAY","fila": 2},
{"PaisExportador": "HONG KONG","fila": 3},
{"PaisExportador": "CHINA","fila": 4}
];
matriz = [[{"nombre": "CHINA","cant": 2}],
[{"nombre": "URUGUAY","cant": 1}],
[{"nombre": "HONG KONG","cant": 1}]
]