# Get value from ctx.payload.results

**URL:** <https://discuss.elastic.co/t/get-value-from-ctx-payload-results/275423>\
**Category:** Elasticsearch\
**Created:** [June 9, 2021, 10:50am UTC](https://discuss.elastic.co/t/get-value-from-ctx-payload-results/275423 "2021-06-09T10:50:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [June 9, 2021, 10:50am UTC](https://discuss.elastic.co/t/get-value-from-ctx-payload-results/275423/1 "2021-06-09T10:50:21Z")

</div>

I'm trying to extract the results from the payload to display in a message for a watcher  
The value is in

```auto
      "payload": {
        "results": [
          {
            "value": 1644,
            "key": "foo"
          }
        ]
      }

```

if I try to reference as **{{ctx.payload.results}}**  
I get this:

{0={value=1644, key=foo}}

What I need is only the value 1644, or the key "foo"

I also try to use  
**ctx.payload.results.value**  
**ctx.payload.results.[0]**  
**ctx.payload.results.['value']**

nothing works

Any idea how to get it from the array?

---

<div class="post-metadata">

**Author:** ![A\_Mightiev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_mightiev/32/62186_2.png) [@A\_Mightiev](https://discuss.elastic.co/u/A_Mightiev)\
**Post date:** [June 9, 2021, 11:32am UTC](https://discuss.elastic.co/t/get-value-from-ctx-payload-results/275423/2 "2021-06-09T11:32:25Z")

</div>

I found it,  
**ctx.payload.results.0.value**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 7, 2021, 11:33am UTC](https://discuss.elastic.co/t/get-value-from-ctx-payload-results/275423/3 "2021-07-07T11:33:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
