_.toPairsIn is a Lodash Object helper (since 4.0.0). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Closest native pattern is a for...in loop collecting [key, value] pairs; Object.entries() covers own keys only. Alias: _.entriesIn.
✓ Stable · Lodash 4.x
_.toPairsIn()
Available in [email protected] full builds and the lodash/toPairsIn 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
_.toPairsInLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import toPairsIn from "lodash/toPairsIn" for smaller builds. Best for prototype inspection — not everyday JSON-shaped data.
Frequently Asked Questions
_.toPairsIn(object) returns [key, value] pairs for own and inherited enumerable string-keyed properties — like for...in turned into pairs.
toPairs is own keys only. toPairsIn also walks the prototype chain for inherited enumerable keys.
Object.entries() is own-only. There is no built-in entriesIn — you would write a for...in loop yourself.
No. It returns a new array. The source object is unchanged.
No. Nested values stay nested inside each pair’s value slot.
Use import toPairsIn from "lodash/toPairsIn" or require("lodash/toPairsIn"). Full build: _.toPairsIn. Alias: _.entriesIn.