The Object.fromEntries() method transforms a list of key-value pairs into an object.




An iterable such as Array or Map or other objects implementing the iterable protocol.

Return value

A new object whose properties are given by the entries of the iterable.


The Object.fromEntries() method takes a list of key-value pairs and returns a new object whose properties are given by those entries. The iterable argument is expected to be an object that implements an @@iterator method, that returns an iterator object, that produces a two element array-like object, whose first element is a value that will be used as a property key, and whose second element is the value to associate with that property key.

Object.fromEntries() performs the reverse of Object.entries().


Converting a Map to an Object

With Object.fromEntries, you can convert from Map to Object:

const map = new Map([ ['foo', 'bar'], ['baz', 42] ]);
const obj = Object.fromEntries(map);
console.log(obj); // { foo: "bar", baz: 42 }

Converting an Array to an Object

With Object.fromEntries, you can convert from Array to Object:

const arr = [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ];
const obj = Object.fromEntries(arr);
console.log(obj); // { 0: "a", 1: "b", 2: "c" }

Object transformations

With Object.fromEntries, its reverse method Object.entries(), and array manipulation methods, you are able to transform objects like this:

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

const object2 = Object.fromEntries(
  .map(([ key, val ]) => [ key, val * 2 ])

// { a: 2, b: 4, c: 6 }


Specification Status
Object.fromEntries proposal Stage 3

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung InternetNode.js
Basic supportChrome No support NoEdge No support NoFirefox Full support 63IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android Full support 63Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No


Full support  
Full support
No support  
No support

See also

Document Tags and Contributors

Contributors to this page: sideshowbarker, urty5656, mfuji09, wbamberg, fscholz
Last updated by: sideshowbarker,