I have a JSON array like below:
rows =[
{
"ID":132,
"TITLE":"Questions one",
"DESCRIPTION":"Questions one DESCRIPTION",
"EXPERT_RATING":3,
"DURATION":15,
"SOURCE_URL":"http://testing.com",
"COMMENT":null,
"UserID": 1214
},
{
"ID":137,
"TITLE":"Questions two",
"DESCRIPTION":"Questions two description",
"EXPERT_RATING":3,
"DURATION":15,
"SOURCE_URL":"http://question2.com",
"COMMENT":null,
"UserID": 1214
}
]
Now, I want to push it into an array, so it should look like below:
res[132] = ['Questions one', 'Questions one DESCRIPTION', 3, 15, 'http://testing.com', null, 1214]
res[137] = ['Questions two', 'Questions two DESCRIPTION', 3, 15, 'http://question2.co', null,1214]
I have tried the following cod, but is showing lot of null records
rows.forEach(function(key){
recJson[key.ID] = [key.TITLE, key.DESCRIPTION, key.EXPERT_RATING, key.DURATION, key.SOURCE_URL, key.COACHING_TIPS, key.MGR_COMMENT, key.UserID]
});
console.log(recJson);
Tell me what I am doing wrong?