I have the following array in my source code:
var employees = [ { "Question":"question 1", "Answer":"answer 1" }, { "Question":"question 1", "Answer":"another answer 1" }, { "Question":"question 2", "Answer":"answer 2" } ];
I need to create a function that can group all the answers that are related to the same question and put the info in a JSON object
{ "Question":"question 1", "Answer" : '[{"answer 1","another answer 1"}]' }, { "Question":"question 2", "Answer" : '[{"answer2"}]' }