Categories

Get Path

Get a value at a path using lodash _.get

Get a value from an object or array using a property path.

Highlights:

  • Uses lodash _.get
  • Supports dot and bracket paths
  • Optional JSON default value

Example:

  • Input: {"user":{"name":"Ada"}}
  • Path: user.name
  • Result: "Ada"

Enter a JSON object or array

Property path to read

Optional JSON default value

Key Facts

Category
Data Processing
Input Types
textarea, text
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The Get Path tool allows you to precisely extract values from complex JSON objects or arrays using the reliable lodash _.get method, supporting both dot and bracket notation for deep property access.

When to Use

  • When you need to extract a specific nested value from a large JSON response.
  • When you want to safely access object properties without risking 'undefined' errors.
  • When you need to provide a fallback value if a specific path does not exist in your data.

How It Works

  • Paste your JSON object or array into the input field.
  • Define the path to the desired property using standard dot notation (e.g., user.profile.id) or bracket notation (e.g., users[0].name).
  • Optionally provide a default JSON value to return if the path is not found.
  • Execute the tool to retrieve the specific value instantly.

Use Cases

Extracting specific configuration settings from a nested JSON settings file.
Parsing individual user details from a large API response array.
Retrieving default values from a configuration object when specific keys are missing.

Examples

1. Extracting User Email

Developer
Background
An API returns a complex user object containing nested profile and contact information.
Problem
Need to quickly isolate the user's email address without manually parsing the entire JSON string.
How to Use
Paste the full JSON into the Input field and set the Path to 'contact.email'.
Example Config
Path: contact.email
Outcome
The tool returns the specific email string found at that path.

2. Accessing Array Item

Data Analyst
Background
A dataset contains a list of products, and the first item needs to be checked for a specific status.
Problem
Accessing the status property of the first object in a large array.
How to Use
Input the product array and use the path 'products[0].status'.
Example Config
Path: products[0].status
Outcome
The tool returns the status value of the first product in the list.

Try with Samples

json

Related Hubs

FAQ

What library does this tool use?

This tool utilizes the industry-standard lodash _.get function for robust data retrieval.

Can I access array elements?

Yes, you can use bracket notation (e.g., items[0].price) to access specific elements within an array.

What happens if the path does not exist?

If the path is not found, the tool will return 'undefined' unless you provide a custom default value.

Does it support deep nesting?

Yes, the tool supports arbitrarily deep paths as long as the structure is valid JSON.

Is the input data validated?

The tool expects valid JSON input; ensure your data is correctly formatted before processing.

API Documentation

Request Endpoint

POST /en/api/tools/get-path

Request Parameters

Parameter Name Type Required Description
inputData textarea Yes Enter a JSON object or array
path text Yes Property path to read
defaultValue textarea No Optional JSON default value

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-get-path": {
      "name": "get-path",
      "description": "Get a value at a path using lodash _.get",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=get-path",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]