How to convert similar/duplicate "id"s with different values inside an object to formatted array : <p>I have an objects with similar ids</p>

<pre><code>[{
"_id": "603",
"name": 'innova',
"type": 'suv',
"brand": 'toyota'
},
{
"_id": "902",
"name": 'i20',
"type": 'hashback',
"brand": 'hyundai'
},
{
"_id": "603",
"name": 'indigo',
"type": 'haskback',
"brand": 'toyota'
}]
</code></pre>

<p>should be converted to </p>

<pre><code>[{
"_id": "603",
"name": ['innova', 'indigo'],
"type": ['suv', 'haskback'],
"brand": ['toyota', 'toyota']
}, {
"_id": "902",
"name": ['i20'],
"type": ['hashback'],
"brand": ['hyundai']
}]
</code></pre>

<p>i have tried using Object.keys and Object.Values by pushing them if id already exits but failed.</p>
