var data = { firstName: 'John', lastName: 'Doe', email: '[email protected]' }
var output = Object.entries(data).map(([key, value]) => ({key,value}));
console.log(output);
Inspired By this post
More Related Contents:
- How do I check if an array includes a value in JavaScript?
- How can I check if an object is an array? [duplicate]
- Converting JavaScript object with numeric keys into array
- Why can I add named properties to an array as if it were an object?
- Are Javascript arrays primitives? Strings? Objects?
- How to map more than one property from an array of objects
- Find object by id in an array of JavaScript objects
- Sorting arrays numerically by object property value
- Sum of array object property values in new array of objects in Javascript [duplicate]
- Create an empty object in JavaScript with {} or new Object()?
- Array Like Objects in Javascript
- Create object from array
- Length of a JavaScript associative array
- Comparing two arrays of objects, and exclude the elements who match values into new array in JS
- How to find duplicate values in a JavaScript array of objects, and output only unique values?
- What’s the difference between “{}” and “[]” while declaring a JavaScript array?
- Search array of objects for entry matching variable and check if it matches other fields
- Returning only certain properties from an array of objects in Javascript [duplicate]
- How to merge each object within arrays by index?
- How to convert array of key–value objects to array of objects with a single property?
- How to get all keys with values from nested objects
- flattening the nested object in javascript
- Array of object deep comparison with lodash
- Does an array contain a specific item? [duplicate]
- How to get the difference between two arrays of objects in JavaScript
- How to delete an item from state array?
- Javascript – remove an array item by value [duplicate]
- Sorting on a custom order
- Index an array of arrays with an array of indexes in javascript
- push() a two-dimensional array