> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odella.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract Object Path Block

> Extract data from objects or arrays using JSONPath queries

<Frame>
  <img src="https://mintcdn.com/odella/I7v1Fbrp2kx7rLoj/block-reference/assets/extract_object_path_light.png?fit=max&auto=format&n=I7v1Fbrp2kx7rLoj&q=85&s=23123147e936534b20a4a5d726122f8d" alt="Extract Object Path Block Screenshot" className="block dark:hidden" width="896" height="380" data-path="block-reference/assets/extract_object_path_light.png" />

  <img src="https://mintcdn.com/odella/I7v1Fbrp2kx7rLoj/block-reference/assets/extract_object_path_dark.png?fit=max&auto=format&n=I7v1Fbrp2kx7rLoj&q=85&s=153ea79c04b98c683764b2483735becd" alt="Extract Object Path Block Screenshot" className="hidden dark:block" width="908" height="414" data-path="block-reference/assets/extract_object_path_dark.png" />
</Frame>

## Overview

The Extract Object Path Block allows you to run [JSONPath](https://www.npmjs.com/package/jsonpath-plus) queries on objects or arrays. This block is particularly useful for extracting specific data from complex JSON structures, such as API responses or nested objects.

## Key Features

* Extract data using JSONPath queries
* Support for objects, arrays, and other JavaScript values with properties
* Ability to perform complex queries and filtering
* Dynamic path construction using input ports

## Inputs

<ParamField path="object" type="object | any[] | string" required>
  The object, array, or string to query using the JSONPath.
</ParamField>

<ParamField path="path" type="string" required>
  The JSONPath query to use for extracting properties from the input object. Only available when "Use Path Input" is enabled in settings.
</ParamField>

## Outputs

<ResponseField name="match" type="any">
  The first value that matches the specified path. If no match is found, this output will be control-flow-excluded.
</ResponseField>

<ResponseField name="all_matches" type="any[]">
  An array of all values that match the specified path. If no matches are found, this output will run with an empty array.
</ResponseField>

## Editor Settings

<ParamField path="path" type="string" default="$">
  The JSONPath query to use for extracting properties from the input object. Uses JSONPath syntax.
</ParamField>

<ParamField path="usePathInput" type="boolean" default={false}>
  When enabled, allows the path to be provided via an input port instead of being set in the settings.
</ParamField>

## Example: Extract a property from an object

1. Create an Object Block with the following JSON:
   ```json theme={"system"}
   {
     "name": "John Doe",
     "age": 30
   }
   ```
2. Add an Extract Object Path Block and connect the Object Block to it.
3. Set the `Path` of the Extract Object Path Block to `$.name`.
4. Run the flow. The Extract Object Path Block should output `John Doe`.

## Error Handling

* If the path is invalid or not provided, the block will throw an error
* If the path is valid but no value is found, the `match` output will be control-flow-excluded and the `all_matches` output will run with an empty array
* If the input object is undefined or null, it will be treated as null for the JSONPath query

## FAQ

<AccordionGroup>
  <Accordion title="Can I use this block with non-object data types?">
    Yes, the Extract Object Path Block can work with arrays and other JavaScript values that have properties, such as strings. For example, you can use `$.length` to get the length of a string.
  </Accordion>

  <Accordion title="How can I extract data from an API response?">
    You can use the HTTP Call Block to make an API request, and then use the Extract Object Path Block to extract specific data from the response.
  </Accordion>
</AccordionGroup>

## See Also

* [Code Block](/block-reference/advanced/code)
* [Object Block](/block-reference/data/object)
* [Array Block](/block-reference/data/array)
* [Extract with Regex Block](/block-reference/modifiers/extract-with-regex)
* [Data Types](/workflow/data-types)
