Given an associative array (of the sort returned by jQuery.serializeArray()
) like this:
[
{ 'name': 'abc', 'value': 'aaa', '__proto__': [Object] },
{ 'name': 'def', 'value': 'bbb', '__proto__': [Object] },
{ 'name': 'abc', 'value': 'ccc', '__proto__': [Object] }
]
How can one convert this, using either jQuery or just javascript, to an associative array of name: [values]
like this:
{
'abc': ['aaa', 'ccc'],
'def': ['bbb']
}
This seems to essentially be the inverse of this question: Build associative array based on values of another associative array... but in Javascript (not PHP). I wasn't able to find this question on Stackoverflow, though I thought it would have been asked.
Thank you for reading.
Brian