# Has In Path

Check if a path exists using lodash _.hasIn

> Canonical page: https://elysiatools.com/en/tools/has-in-path

- **Category:** Data Processing

- **Keywords:** hasIn, path, lodash, object, array

## Overview

Check if a property path exists on an object, including inherited properties.

**Highlights:**
- Uses lodash `_.hasIn`
- Checks own and inherited properties
- Returns true or false

**Example:**
- Input: `{"user":{"name":"Ada"}}`
- Path: `user.name`
- Result: `true`

## Inputs

- **Input** (textarea): Enter a JSON object or array
- **Path** (text): Property path to check

## When to use

- When you need to confirm if a nested property exists in a complex data structure.
- When you must account for inherited properties that standard existence checks might miss.
- When debugging data objects to ensure required keys are present before processing.

## How it works

- Paste your JSON object or array into the input field.
- Specify the dot-notation path you wish to verify (e.g., user.profile.id).
- The tool utilizes lodash's _.hasIn method to perform a deep check.
- Receive a boolean true or false result indicating if the path exists.

## Use cases

- Validating configuration objects that rely on prototype inheritance.
- Checking for the presence of nested API response fields before mapping data.
- Debugging data structures where properties might be defined on the prototype.

## Frequently asked questions

### What is the difference between hasIn and has?

The hasIn method checks both own and inherited properties, whereas standard has checks only for own properties.

### Does this tool support array indices in the path?

Yes, you can use dot notation to access array indices, such as users.0.name.

### What happens if the input JSON is invalid?

The tool will return an error indicating that the provided input is not a valid JSON format.

### Can I check for properties on a null or undefined object?

If the base object is null or undefined, the tool will return false as the path cannot be resolved.

### Is the check case-sensitive?

Yes, property names in the path must match the casing of the keys in your JSON exactly.

## Related tools

- [Has Path](https://elysiatools.com/en/tools/has-path): Check if a path exists using lodash _.has
- [Assign In Object](https://elysiatools.com/en/tools/assign-in-object): Assign own and inherited properties using lodash _.assignIn
- [Assign Object](https://elysiatools.com/en/tools/assign-object): Assign source properties to a target object using lodash _.assign
- [Count By](https://elysiatools.com/en/tools/count-by): Count items by a derived key using lodash _.countBy
- [For In Object](https://elysiatools.com/en/tools/for-in-object): Iterate over object properties using lodash _.forIn
- [From Pairs](https://elysiatools.com/en/tools/from-pairs): Convert array of key-value pairs to object using lodash _.fromPairs
- [Get Path](https://elysiatools.com/en/tools/get-path): Get a value at a path using lodash _.get
- [Group By](https://elysiatools.com/en/tools/group-by): Group items by a derived key using lodash _.groupBy

## 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
