Answers for "how to transform an object into array"

2

convert object to array

const rooms = {r1: "Room 1", r2: "Room 2", r3: "Room 3"};

const arrayResult = Object.keys(rooms).map(room => {
    return {id: room, name: rooms[room]} 
});
Posted by: Guest on July-18-2021
0

convert object to array

$array = json_decode(json_encode($object), true);
Posted by: Guest on January-26-2022

Code answers related to "how to transform an object into array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language