# Field Extraction Node

### Overview

The Field Extraction Node extracts specific fields from objects, documents, or complex data structures within your flow. This node is essential for accessing nested data, array elements, or specific properties from structured inputs. It supports both simple field access and advanced dot notation for deep object traversal.

**Usage cost:** 0 credit

### Configuration

**Source Selection**

* **Source Object**\* (dropdown): Select the object or variable to extract from
  * Only variables of type object, document, or any are available
  * Shows variable type and source node for easy identification

**Extraction Configuration**

* **Extraction Mode**\* (dropdown): Method for field access
  * **Simple**: Direct field access for top-level properties
    * Use field names like `"name"`, `"email"`
    * Use numeric indices for arrays like `"0"`, `"1"`
  * **Dot Notation**: Nested access for complex structures
    * Use paths like `"user.profile.name"`, `"items.0.title"`
    * Supports mixed object/array navigation
* **Field Key/Path**\* (text): The field identifier
  * **Simple mode**: Direct field name or array index
  * **Dot notation mode**: Full path using dot separation
  * Examples: `"name"`, `"user.profile.email"`, `"items.0.metadata.source"`

**Default Handling**

* **Default Value** (text): Value returned if field is not found
  * Supports variable interpolation for dynamic defaults
  * Leave empty to return `null` when field is missing
  * Can reference other variables as fallback values

### Output Ports

* `extracted_value` (any): The extracted field value
  * Returns the actual data type of the extracted field
  * Returns default value if field doesn't exist or is null
  * Preserves original data structure (strings, numbers, objects, arrays)

### Best Practices

#### **Field Path Design**

* Verify field names are exact matches (case-sensitive)
* Use dot notation for accessing nested structures consistently
* Test extraction paths with sample data before deployment

#### **Default Value Strategy**

* Provide meaningful defaults for optional fields
* Use variable references for dynamic fallback values
* Consider downstream node requirements when setting defaults

#### **Data Type Handling**

* Remember that extracted values maintain their original data types
* Plan for different data types in downstream processing
* Use appropriate type checking in subsequent nodes

### Common Issues

* **Case sensitivity errors** - Field names must match exactly including capitalization
* **Array index out of bounds** - Verify array length before accessing specific indices
* **Nested path errors** - Check that all intermediate objects exist in the path
* **Type mismatch expectations** - Extracted values retain original data types


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.waterflai.ai/studio/studio-builders/flow-components-nodes/field-extraction-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
