Guard. Still returns a plain object you can merge safely.
Compatibility
Browser & Runtime Support
_.toPlainObject is a Lodash 4.x Lang helper. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. There is no single native equivalent; people approximate with Object.create / for…in or Object.assign plus keysIn-style walks.
✓ Stable · Lodash 4.x
_.toPlainObject()
Available in [email protected] full builds and the lodash/toPlainObject 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
_.toPlainObjectLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import toPlainObject from "lodash/toPlainObject" for smaller builds. Use when APIs need inherited enumerable keys as own properties.
Frequently Asked Questions
It converts value into a new plain object and copies inherited enumerable string-keyed properties onto that object as own properties.
The result is always a plain Object (Object.prototype). Inherited enumerable keys from the input are copied as own keys — it does not drop them.
Spread ({ ...obj }) copies only own enumerable keys. _.toPlainObject also walks the prototype chain (like keysIn).
_.assign copies only own enumerable keys. Wrapping with toPlainObject first lets assign merge inherited enumerable keys too — the official docs demo.
No. Nested objects and arrays stay the same references. Use _.cloneDeep when you need a deep clone.
They produce {}. Strings and arrays contribute their enumerable index keys; non-enumerable length is not copied.