Create a javascript object with one key but multiple value I want something like this created with a for loop
'Addresses': {
'91e3e4ec8fbfc57477e05ca58679d830a2982a49a8d3fe60119ca84d640028ef': {
'ChannelType': 'APNS',
'Substitutions': {}
},
'test@test.com': {
'ChannelType': 'EMAIL',
'Substitutions': {}
},
}`
so addresses is the key, but inside the value of the key there is another key value pair. How do i create this dynamically in javascript?
what i have tried is
for(var i = 0; i < data.EndpointsResponse.Item.length; i++) {
address[data.EndpointsResponse.Item[i].Address] = {
'ChannelType':
data.EndpointsResponse.Item[i].ChannelType
};
but it is creating it in the format
'Addresses': {
'91e3e4ec8fbfc57477e05ca58679d830a2982a49a8d3fe60119ca84d640028ef':
'ChannelType': 'APNS',
'Substitutions': {}
,
'test@test.com':
'ChannelType': 'EMAIL',
'Substitutions': {}
,
}`
which is different from what i want