# Scripted Field for elements inside lists of JSON objects

**URL:** <https://discuss.elastic.co/t/scripted-field-for-elements-inside-lists-of-json-objects/91585>\
**Category:** Kibana\
**Created:** [July 3, 2017, 4:35am UTC](https://discuss.elastic.co/t/scripted-field-for-elements-inside-lists-of-json-objects/91585 "2017-07-03T04:35:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [July 3, 2017, 4:08pm UTC](https://discuss.elastic.co/t/scripted-field-for-elements-inside-lists-of-json-objects/91585/2 "2017-07-03T16:08:42Z")

</div>

Hi there, I found this similar thread from awhile back: [Changing all array elements in scripted field](https://discuss.elastic.co/t/changing-all-array-elements-in-scripted-field/82246)

In that thread, the author uses the "values" property to retrieve all of the values in the array. So in your example, it would be:

```auto
def roles = doc["author.roles.name.keyword"].values

```

Can you try this and let me know if it works for you?

Thanks,  
CJ

---

_[View the full topic](https://discuss.elastic.co/t/scripted-field-for-elements-inside-lists-of-json-objects/91585)._
