# Extract Fields from JSON Array

**URL:** https://discuss.elastic.co/t/extract-fields-from-json-array/150718
**Category:** Logstash
**Created:** [October 2, 2018, 2:08pm UTC](https://discuss.elastic.co/t/extract-fields-from-json-array/150718 "2018-10-02T14:08:04Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 3, 2018, 6:23pm UTC](https://discuss.elastic.co/t/extract-fields-from-json-array/150718/2 "2018-10-03T18:23:39Z")

</div>

The problem is that `[exiftoolMetadata][exiftool][value]` is sometimes a string and sometimes a number. A particular Elasticsearch field must have a single type.

Your instinct to turn those key/value pairs into discrete fields is correct. Ruby examples of doing that have been posted in the past. Perhaps [Split arrays of keys and values](https://discuss.elastic.co/t/split-arrays-of-keys-and-values/90736) is helpful?

---

_[View the full topic](https://discuss.elastic.co/t/extract-fields-from-json-array/150718)._
