
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
restructures flat objects with dot-notation-like keys into optimised nested objects
// Fatten turns flat objects
const 😡 = { id: 5, user_id: 14, user_name: 'Jane', payment_provider: 'stripe' };
// Into optimised nested objects
const 😍 = { id: 5, user: { id: 14, name: 'Jane' }, paymentProvider: 'stripe' };
// By doing this
const 🤯 = fatten(😡, { separator: '_' });
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
npm install fatten
yarn add fatten
import { fatten } from 'fatten';
const options = {
separator: '-',
leafKey: 'value'
};
const nestedObject = fatten(flatObject, options);
separator (default: '.')The character used to split the keys of the flat object.
leafKey (default: '_')The key that represents a node with a value inside a deeper path.
Example:
const result = fatten({ id: 5, 'id.version': '2', type: 'mailable' }) // is the same as const result = { id: { _: 5, version: '2' }, type: 'mailable' }
Please see releases for more information what has changed recently.
npm run test
Please see CONTRIBUTING for details.
If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
FAQs
restructures flat objects with dot-notation-like keys into optimised nested objects
We found that fatten demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.