---
updatedAt: 2026-04-14T09:44:14.000Z
agentTools:
  projectIndex: https://developers.newo.ai/llms.txt
---

# GetItemsArrayByPathJSON

Returns an element within an array based on a JSON path.

```
GetItemsArrayByPathJSON(
  array: str, 
  filterPath: str
)
```

#### Parameters

* **array:** An array in the format '\[\{"first\_name": "Brad", "last\_name": "Pitt"}]\[\{"first\_name": "Brad", "last\_name": "Pitt"}]' for example.
* **filterPath:** A string in JSONPath format to traverse the path to an element in a JSON structure.

### Example

The example below returns an element in an array by specifying its JSONPath.

```Text Skill Script
{{set(
   name="MyArray",
   value=AppendItemsArrayJSON(
       array="[]",
       items=[
           '{
               "first_name": "Brad",
               "last_name": "Pitt"
           }',
           '{
               "first_name": "Matt",
               "last_name": "Damon"
           }'
       ]
   )
)}}

{{SendMessage(message=MyArray)}}

{{set(
    name="PathArray",
    value=GetItemsArrayByPathJSON(
        array=MyArray, 
        filterPath="[1].first_name"
        )
)}}

{{SendMessage(message=PathArray)}}
```
```Text Response
[\{"first_name":"Brad","last_name":"Pitt"},\{"first_name":"Matt","last_name":"Damon"}]

[\{"first_name":"Matt","last_name":"Damon"}]
```