javascript

Convert object {key: value} to Array [[key, value]] Javascript

You can use Object.entries() method to convert object attributes into array of attributes.

const obj = { a: 1, b: 2, c: 3 };

const entries = Object.entries(obj);
Output
[["a",1],["b",2],["c",3]]

Live Demo

Was this helpful?