I am currently working with two arrays of JSON objects in Angular. Both dictionaries have a key-value pair called "song_id" in common. My goal is to combine the "rating" key-value from the second array into the first array where the song_id matches.
Array 1:
this.Array1 = [
{"song_id": 01, "artist_name": "Arijit, Shreya", "song_name": "Song1"},
{"song_id": 02,"artist_name": "Jason, Ankit", "song_name": "Song2"},
{"song_id": 03,"artist_name": "Asha, Lata, Bapi", "song_name": "Song3"},
]
Array 2:
this.Array2 = [
{"song_id": 01, "user_id": 5, "rating": 4},
{"song_id": 02, "user_id": 5, "rating": 5},
{"song_id"" 03, "user_id": 5, "rating": 3},
]
Expected Outcome:
this.Array1 = [
{"song_id": 01, "artist_name": "Arijit, Shreya", "song_name": "Song1", "rating": 4},
{"song_id": 02,"artist_name": "Jason, Ankit", "song_name": "Song2", "rating": 5},
{"song_id"": 03,"artist_name": "Asha, Lata, Bapi", "song_name": "Song3", "rating": 3},
]