# Extract Field

> Pull one field or a nested path, such as title or authorMeta.name, out of JSON data, and send it on as text, as a list to run once per item, or as JSON.

Source: https://nodaro.ai/docs/nodes/automate/extract-field

The **Extract Field** node pulls one field, or a nested path of fields, out of JSON data. Choose the field from the fields detected in the upstream data, or type a dot path such as `authorMeta.name`. The node sends the result as one text, as a list that can run the next node once per value, or as raw JSON. It runs instantly and costs no credits.

- Found in: Automate › Logic & Data
- Output: data
- API type: `extract-field`

## When to use it
- Pull the `title` or `url` of every search result out of [Web Scrape](https://nodaro.ai/docs/nodes/automate/web-scrape) before a batch.
- Take a nested value, such as the author's name inside each scraped post.
- Turn a JSON array into a list of texts for a [Prompt](https://nodaro.ai/docs/nodes/automate/prompt) node.
- Reach deeply nested data by chaining two Extract Field nodes.

## Quick start
### Add the node

Press Tab on the canvas and choose **Automate › Logic & Data › Extract Field**.

### Connect JSON data

Wire a node that sends JSON into the **Source** input, for example [Web Scrape](https://nodaro.ai/docs/nodes/automate/web-scrape) or a [Prompt](https://nodaro.ai/docs/nodes/automate/prompt) node that answers in JSON.

### Choose the field

Open the settings panel. Once the upstream node has a result, **Field** lists the fields it found. Choose one, or choose **Custom path…** and type a dot path.

### Choose the output type and run

Set **Output Type** to **Text**, **List** or **JSON**, and run the node. **Output Preview** shows the result.

Workflow: Extract Field takes the title of every search result as a list, and Generate Image makes one image per headline.

- Web Scrape → Extract Field (source)
- Extract Field → Generate Image (prompt · Each)

## Inputs and outputs
| Input or output | Accepts or sends | What it does |
| --- | --- | --- |
| **Source** | JSON, text that contains JSON, or a list | The data to read. |
| **Text** or **JSON** | Text, a list or JSON | The extracted values, in the format chosen under **Output Type**. The output is labeled **JSON** when the output type is JSON. |

## Settings
| Setting | What it does |
| --- | --- |
| **Field** | The field to extract. Detected fields appear once an upstream node is connected and has data. **(whole item)** uses each element of an array as it is. **Custom path…** switches to a typed **Path**. |
| **Path** | A dot path such as `caption` or `authorMeta.name`. When the data is an array, the path runs against each element. Leave it empty to use each element as it is. **← Back to field list** returns to the detected fields. |
| **Output Type** | **Text**, the default, joins the values into one text, one value per line. **List** sends each value as a separate item, which works with the **Item** and **Each** connection modes. **JSON** sends the raw value, to chain another Extract Field or a node that reads JSON. |

## Keep two fields paired

To use two fields of the same array together, for example `prompt` and `negative` from a list of concepts:

1. Add one Extract Field per field, both with **Output Type** set to **List**.
2. Wire each one into its own input of the next node, with both connections set to **Each**. You can also wire them into two columns of a [List](https://nodaro.ai/docs/nodes/automate/list).

The two lists pair up by array element: run 3 gets the `prompt` and the `negative` of element 3. An element without a `negative` gives that run no negative, and the runs after it do not shift. A run never starts for an element that has no value at all. A field that only some elements have, such as a video link, therefore runs once per value that exists.

Picking by position counts only the values that exist. **Item N**, ranges and **Bundle** count existing values, and the **Text** output lists the existing values, one per line.

## When the JSON comes from an AI model

When a [Prompt](https://nodaro.ai/docs/nodes/automate/prompt) node writes the JSON, ask it to return raw JSON only, without a code fence and without a sentence before or after it. Otherwise, Extract Field fails with the error "Input is not valid JSON".

## Credits
Extract Field is free.

## Tips
- **Connect first, then choose.** The **Field** list fills from the upstream data, so you do not need to remember key names.
- **Flat lists.** When the JSON is already a flat list, such as `["a", "b", "c"]`, leave **Field** on **(whole item)** and set **Output Type** to **List**.
- **Nested objects.** Use dot notation in **Path**, such as `videoMeta.duration`.
- **Arrays in the middle of a path.** Chain two nodes. The first extracts `items` with **Output Type** set to **JSON**; the second extracts `title` from each item.
- **Filter first.** To keep only some items before you extract, use [Filter List](https://nodaro.ai/docs/nodes/automate/filter-list).

## Frequently asked questions

### How do I get the titles out of scraped results?

Connect the scraper to Extract Field and choose title under Field. Set Output Type to List to run the next node once per title, or to Text to get every title in one text, one per line.

### What is the difference between the Text, List and JSON output types?

Text joins the values into one text, one value per line. List sends each value as a separate item, so the next node can run once per item. JSON sends the raw value, for a second Extract Field or another node that reads JSON.

### Why does Extract Field say "Input is not valid JSON"?

The text it received is not pure JSON. When an AI text node writes the JSON, it must return raw JSON only, without a code fence and without a sentence before or after it.

### How do I keep two fields of the same item together, such as prompt and negative?

Add one Extract Field per field, both with Output Type set to List. Wire each one into its own input of the next node, and set both connections to Each. Run 3 then gets the prompt and the negative of the third element.

### Does Extract Field cost credits?

No. Extract Field runs instantly and is free.
