I have a function that returns an array, as follows:
But I'm trying to populate a SweetAlert2 dialog.
As the documentation exemplifies, the desired input would look like this
inputOptions: {
'SRB': 'Serbia',
'UKR': 'Ukraine',
'HRV': 'Croatia'
},
How could I convert my array to the needed format, considering that the key will be the same as the value?
So, something like this would be the result:
{
'aaa123': 'aaa123',
'Açucena': 'Açucena',
'Braúnas': 'Braúnas',
[...]
}
I have tried JSON.stringify
, but the output is not what I need:
"[["aaa123","Açucena","Braúnas","C. Fabriciano","gege","gegeq2","Ipatinga","Joanésia","Mesquita","Rodoviário","teste","teste2","Timóteo","Tomatoentro","ts"]]"