I have a list of objects coming from the backend like below
const paramData = [
{id: "search_type", value: "All items", required: true},
{id: "time_period", value: "Week", required: false},
{id: "user_type", value: "All Users", required: false},
{id: "question_type", value: "Multiple questions", required: true},
];
I would like to extract the values of only the id and the value key of each object and make something like below
const extractedData = "{\"search_type\": \"All items\", \"time_period\": \"Week\", \"user_type\": \"All Users\", \"question_type\": \"Multiple questions\"}";
What would be the optimum way to achieve this?