Expand._.toPairs turns { a: 1, b: 2 } into [["a",1],["b",2]].
Fold._.fromPairs rebuilds the object from those rows.
New object. The result is a new reference, not the same as original.
Limit. Prototype / symbol / nested path cases need other tools.
Compatibility
Browser & Runtime Support
_.fromPairs is a Lodash 4.x Array helper (added in 4.0.0). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.0.0+
_.fromPairs()
Available in [email protected] full builds and the lodash/fromPairs modular import. Prefer Lodash 4.0.1+ so dotted keys are treated as literal names (fixed vs early 4.0.0 path bug).
100%With Lodash 4.0.1+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.fromPairsLodash 4.0.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import fromPairs from "lodash/fromPairs" for smaller builds. Native alternative: Object.fromEntries (ES2019) for iterables of entries.
Frequently Asked Questions
_.fromPairs(pairs) builds a new plain object from an array of [key, value] pairs. It is the inverse of _.toPairs for typical string-keyed objects.
No. Lodash reads the pairs and returns a new object. The input array is not modified.
Later pairs overwrite earlier ones. The last [key, value] for a given key wins.
Object.fromEntries accepts any iterable of entries (including Map). _.fromPairs expects an array of pair arrays and matches classic Lodash style.
_.zipObject(keys, values) takes two parallel arrays. _.fromPairs takes one array of [key, value] rows — better when pairs already travel together.
Use import fromPairs from "lodash/fromPairs" or require("lodash/fromPairs") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.fromPairs.