# Determine field type

**URL:** <https://discuss.elastic.co/t/determine-field-type/34146>\
**Category:** Logstash\
**Created:** [November 9, 2015, 12:24pm UTC](https://discuss.elastic.co/t/determine-field-type/34146 "2015-11-09T12:24:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![radu.stefanache](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@radu.stefanache](https://discuss.elastic.co/u/radu.stefanache)\
**Post date:** [November 9, 2015, 12:24pm UTC](https://discuss.elastic.co/t/determine-field-type/34146/1 "2015-11-09T12:24:45Z")

</div>

Hello everyone,

I need a bit of help with this one .  
I get an object in two forms :  
1st form

```
{ "parent": { "child": { "id": 123 } } }

```

2nd form

```
{ "parent": { "child": [{ "id": 123 }] } }

```

I know that in the 2nd case I must use the split filter which works fine but here's the question :  
How do you determine if the field type is an Array ?

```
if [parent][child][] {
 do stuff
} 

```

???

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![radu.stefanache](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@radu.stefanache](https://discuss.elastic.co/u/radu.stefanache)\
**Post date:** [November 17, 2015, 11:01am UTC](https://discuss.elastic.co/t/determine-field-type/34146/2 "2015-11-17T11:01:37Z")

</div>

Anyone here ?

---

<div class="post-metadata">

**Author:** ![Jackal9301](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jackal9301/32/5748_2.png) [@Jackal9301](https://discuss.elastic.co/u/Jackal9301)\
**Post date:** [November 17, 2015, 5:30pm UTC](https://discuss.elastic.co/t/determine-field-type/34146/3 "2015-11-17T17:30:09Z")

</div>

We're here but i'm unsure of how to answer. What are you trying to do in your if statement? You need some type of compare or else it won't do anything.

---

<div class="post-metadata">

**Author:** ![radu.stefanache](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@radu.stefanache](https://discuss.elastic.co/u/radu.stefanache)\
**Post date:** [November 25, 2015, 9:50am UTC](https://discuss.elastic.co/t/determine-field-type/34146/4 "2015-11-25T09:50:55Z")

</div>

I am using the json filter and sometimes in the object I get an array, sometimes I don't .  
What I am looking for is a way to determine if the json object contains an array or not .  
Imagine that I get parent.child.foo and sometimes I get parent.child[foo] . In the second case I must use split .

I don't know if this is clear enough ...

---

<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 6, 2017, 5:21am UTC](https://discuss.elastic.co/t/determine-field-type/34146/5 "2017-07-06T05:21:19Z")

</div>

Closed on July 6, 2017, 5:21am UTC


