JSFiddle - React, Tailwind, and code Playground
by Nick Hulea
JavaScript
const questions = {
"3174010": {
"id": "3174010",
"name": "Question #1",
"weight": "1",
"value": "-1",
"created_at": "2023-10-18 18:28:00",
"updated_at": "2023-10-18 18:28:00"
},
"3174011": {
"id": "3174011",
"name": "Question #2",
"weight": "2",
"value": "-1",
"created_at": "2023-10-18 18:28:00",
"updated_at": "2023-10-18 18:28:00"
},
"3174012": {
"id": "3174012",
"name": "Question #3",
"weight": "3",
"value": "-1",
"created_at": "2023-10-18 18:28:00",
"updated_at": "2023-10-18 18:28:00"
},
"3174013": {
"id": "3174013",
"name": "Question #4",
"weight": "4",
"value": "-1",
"created_at": "2023-10-18 18:28:00",
"updated_at": "2023-10-18 18:28:00"
},
"3174014": {
"id": "3174014",
"name": "Question #5",
"weight": "5",
"value": "-1",
"created_at": "2023-10-18 18:28:00",
"updated_at": "2023-10-18 18:28:00"
}
}
const newQuestions = Object.entries(questions).map(([k, v]) => {
return {
...[k]: v.value,
};
});
console.log(newQuestions)