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

# GetValueJSON

Extracts the value of a specified key from a JSON object. If the key exists in the object, the associated value is returned.

```
GetValueJSON(
  obj: str, 
  key: str
)
```

#### Parameters

* **obj:** An array in the format '\[\{"first\_name": "Brad", "last\_name": "Pitt"}]\[\{"first\_name": "Brad", "last\_name": "Pitt"}]' for example.
* **key:** A string or list of strings representing a numerical value indicating the position of an element in an array.

### Example

The example below searches within the JSON object for the specified key and displays the result in the Sandbox chat.

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

{{SendMessage(message=MyArray)}}

{{set(
   name="LastName",
   value=GetValueJSON(
       obj='
           {
               "first_name": "Leonardo",
               "last_name": "DiCaprio"
           }',
       key="last_name"
   )
)}}

{{SendMessage(message=LastName)}}
```
```Text Response
[\{"first_name":"Brad","last_name":"Pitt"},{"first_name":"Matt","last_name":"Damon"},\{"first_name":"Leonardo","last_name":"DiCaprio"},\{"first_name":"Robert","last_name":"De Niro"}]

"DiCaprio"
```