# How to make a field hold an array, and how to put values in there, and how to loop through an array?

**URL:** <https://discuss.elastic.co/t/how-to-make-a-field-hold-an-array-and-how-to-put-values-in-there-and-how-to-loop-through-an-array/265311>\
**Category:** Logstash\
**Created:** [February 24, 2021, 9:46am UTC](https://discuss.elastic.co/t/how-to-make-a-field-hold-an-array-and-how-to-put-values-in-there-and-how-to-loop-through-an-array/265311 "2021-02-24T09:46:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khalil\_SLEIMI](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khalil_sleimi/32/84324_2.png) [@Khalil\_SLEIMI](https://discuss.elastic.co/u/Khalil_SLEIMI)\
**Post date:** [February 24, 2021, 9:46am UTC](https://discuss.elastic.co/t/how-to-make-a-field-hold-an-array-and-how-to-put-values-in-there-and-how-to-loop-through-an-array/265311/1 "2021-02-24T09:46:39Z")

</div>

Hi there, I'm new to the elk stack, and want some advice concerning how to manipulate json objects. long story short, I have a json that I extracted from an xml, and now, want to change the json of the output, that's why I want to do this:  
I want to split some fields with respect to spaces (similar to `.split(' ')` in java) and then add the array into another field.  
I also want to conditionally check some fields (`if [id][idType] == "Gender" then [gender] = [id][idNumber]` )  
I don't know where to start. So please help me here  
Thank you

---

<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:** [March 24, 2021, 9:47am UTC](https://discuss.elastic.co/t/how-to-make-a-field-hold-an-array-and-how-to-put-values-in-there-and-how-to-loop-through-an-array/265311/2 "2021-03-24T09:47:13Z")

</div>

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