# Assign In Object

Assign own and inherited properties using lodash _.assignIn

> Canonical page: https://elysiatools.com/en/tools/assign-in-object

- **Category:** Data Processing

- **Keywords:** assignIn, object, lodash, merge, properties

## Overview

Assign own and inherited enumerable properties from sources to the target.

**Highlights:**
- Uses lodash `_.assignIn`
- Includes inherited enumerable properties
- Later sources override earlier ones

**Example:**
- Target: `{"a":1}`
- Source 1: `{"b":2}`
- Source 2: `{"a":3}`
- Result: `{"a":3,"b":2}`

## Inputs

- **Target Object** (textarea): Enter the target JSON object
- **Source 1** (textarea): First source object
- **Source 2** (textarea): Optional source object
- **Source 3** (textarea): Optional source object

## When to use

- When you need to merge configuration objects that include inherited properties.
- When you want to update a base object with values from multiple source objects.
- When you need to ensure that later source objects override properties defined in earlier ones.

## How it works

- Enter your base JSON object into the Target Object field.
- Provide one or more source objects in the available source fields.
- The tool processes the inputs using lodash _.assignIn to combine all properties.
- The resulting merged JSON object is displayed as the output.

## Use cases

- Merging default application settings with user-defined overrides.
- Combining data structures from different modules that share a common prototype.
- Flattening multiple configuration layers into a single object for easier access.

## Frequently asked questions

### What is the difference between this and a standard merge?

This tool uses lodash _.assignIn, which specifically includes inherited enumerable properties, unlike standard shallow merges that only look at own properties.

### What happens if multiple sources have the same key?

Later sources override earlier ones. If Source 1 and Source 2 both define the same key, the value from Source 2 will be present in the final result.

### Does this tool modify the original objects?

No, the tool performs the operation and returns a new JSON object without altering your original input data.

### Can I use this for nested objects?

This tool performs a shallow assignment. Nested objects will be replaced entirely by the corresponding value in the source object rather than being merged recursively.

### What if my input is not valid JSON?

The tool requires valid JSON syntax. If the input is malformed, the tool will be unable to parse the objects and will return an error.

## Related tools

- [Defaults Deep](https://elysiatools.com/en/tools/defaults-deep): Apply deep default values using lodash _.defaultsDeep
- [For In Object](https://elysiatools.com/en/tools/for-in-object): Iterate over object properties using lodash _.forIn
- [For Own](https://elysiatools.com/en/tools/for-own): Iterate over own object properties using lodash _.forOwn
- [Invert Object](https://elysiatools.com/en/tools/invert-object): Invert keys and values using lodash _.invert
- [Keys In List](https://elysiatools.com/en/tools/keys-in-list): List own and inherited keys using lodash _.keysIn
- [Keys List](https://elysiatools.com/en/tools/keys-list): List own enumerable keys using lodash _.keys
- [Count By](https://elysiatools.com/en/tools/count-by): Count items by a derived key using lodash _.countBy
- [Find Key](https://elysiatools.com/en/tools/find-key): Find the first matching key using lodash _.findKey

## Samples

- [Grafana Advanced Application Samples](https://elysiatools.com/en/samples/grafana-samples): Comprehensive Grafana samples covering advanced dashboard design, alerting configurations, data source integrations, and plugin development
- [QR Code Samples](https://elysiatools.com/en/samples/qrcode-samples): Sample QR code images for testing QR code reading and generation tools
- [D3.js Data Visualization Samples](https://elysiatools.com/en/samples/d3js-data-visualization): Comprehensive D3.js data visualization examples including charts, maps, animations, and interactive visualizations
- [Rome JavaScript Toolchain Samples](https://elysiatools.com/en/samples/rome): Rome JavaScript toolchain examples including configuration, linting, formatting, bundling, and project management
