Chrome Extension

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);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
[["a",1],["b",2],["c",3]]

Live Demo

Was this helpful?
0 Comments