Extract Object Path Block
Extract data from objects or arrays using JSONPath queries
Overview
The Extract Object Path Block allows you to run JSONPath 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
The object, array, or string to query using the JSONPath.
The JSONPath query to use for extracting properties from the input object. Only available when “Use Path Input” is enabled in settings.
Outputs
The first value that matches the specified path. If no match is found, this output will be control-flow-excluded.
An array of all values that match the specified path. If no matches are found, this output will run with an empty array.
Editor Settings
The JSONPath query to use for extracting properties from the input object. Uses JSONPath syntax.
When enabled, allows the path to be provided via an input port instead of being set in the settings.
Example: Extract a property from an object
- Create an Object Block with the following JSON:
- Add an Extract Object Path Block and connect the Object Block to it.
- Set the
Path
of the Extract Object Path Block to$.name
. - 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 theall_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