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?
Similar Posts
- Lodash - Convert paired Array to key value paired object
- Filter an Array using object key value in Javascript
- Remove a key or property from Object in Javascript
- Remove an object from array by value in Javascript
- Sort array of objects by key value in Javascript
- Javascript to convert all object keys to lowercase
- Convert a string to array using Array.from() in javascript