Why. Array tools are simpler than manual object loops.
Compatibility
Browser & Runtime Support
_.toPairs is a Lodash Object helper (since 0.1.0 as _.pairs; 4.0.0 rename). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Closest native cousin is Object.entries() (ES2017); Lodash also exposes the alias _.entries and pairs cleanly with _.fromPairs.
✓ Stable · Lodash 4.x
_.toPairs()
Available in [email protected] full builds and the lodash/toPairs modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
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
_.toPairsLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import toPairs from "lodash/toPairs" for smaller builds. Ideal before mapping, filtering, or sorting object entries as arrays.
Frequently Asked Questions
_.toPairs(object) returns an array of [key, value] pairs for each own enumerable string-keyed property. Same idea as Object.entries().
No. It returns a new array. The source object is unchanged.
No. Nested values stay nested inside the value slot of each pair.
toPairs is own properties only. toPairsIn also includes inherited enumerable properties.
_.fromPairs(pairs) rebuilds an object from [key, value] pairs. Native: Object.fromEntries().
Use import toPairs from "lodash/toPairs" or require("lodash/toPairs"). Full build: import _ from "lodash" then _.toPairs. Alias: _.entries.