I have an array and would like to convert it to another structure.
My array:
["DZ|47", "DZ|48", "DZ|53", "DZ|57", "AR|202", "AR|206", "AR|213", "BY|484", "BY|485", "BY|487"]
And I would like to convert this into:
{"DZ":[47,48,53,57],"AR":[202,206,213],"BY":[484,485,487]}
I'm started to write the code, but...what next?
$.each(arr, function( index, value ) {
var idx = value.split('|');
//arr2[idx[0]] = arr3;
});
Thanks!