Toolbox-XToolbox-X

Merge And Flatten Objects

Deeply merges multiple objects and flattens the resulting structure using dot notation.

mergeAndFlattenObjects

The mergeAndFlattenObjects function deeply merges multiple objects and flattens the resulting structure using dot notation for nested keys. Duplicate keys are resolved with last-in-wins behavior.

Function Signature

function mergeAndFlattenObjects<T extends GenericObject>(...objects: T[]): FlattenDotValue<MergeAll<T>>

Parameters

  • ...objects (T[]): The objects to merge (variadic arguments).

Return Value

  • FlattenDotValue<MergeAll<T>>: A single merged object with dot-notation keys.

Example Usage

playground.ts

Notes

  • Arrays: Arrays are treated as terminal values and are overwritten, not recursively merged.
  • Returns a new object without mutating the input objects.

Comparison

  • mergeAndFlattenObjects: Outputs a single-level flat object with dot-separated keys.
  • mergeObjects: Outputs a deeply nested merged object structure.

Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)

On this page