# Parsing a JSON array of objects

**URL:** https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441
**Category:** Logstash
**Created:** [July 13, 2016, 7:25pm UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441 "2016-07-13T19:25:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gigavinyl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gigavinyl/32/10875_2.png) [@gigavinyl](https://discuss.elastic.co/u/gigavinyl)
#### Post date: [July 13, 2016, 7:25pm UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/1 "2016-07-13T19:25:26Z")

</div>

I have a log file that's an array of objects that looks something like this:

```javascript
[
  {
     "cate1": "data1a",
     "cate2": "data2a"
  },
  {
     "cate1": "data1b",
     "cate2": "data2b"
  }
]

```

and I need each object in the array to be a separate entry in Elasticsearch and each "cate" to be a field. How would I go about configuring Logstash to do this?

---

<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: [July 14, 2016, 6:18am UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/2 "2016-07-14T06:18:13Z")

</div>

Use the split filter.

---

<div class="post-metadata">

### Author: ![gigavinyl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gigavinyl/32/10875_2.png) [@gigavinyl](https://discuss.elastic.co/u/gigavinyl)
#### Post date: [July 14, 2016, 3:06pm UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/3 "2016-07-14T15:06:42Z")

</div>

I've tried a few variations of using the split filter (by itself, with the json and mutate filters, etc.) but to no avail. Could you demonstrate the proper config for this filter? Thank you. 🙂

---

<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: [July 14, 2016, 6:36pm UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/4 "2016-07-14T18:36:19Z")

</div>

The documentation contains an example that looks very much like what you have: [https://www.elastic.co/guide/en/logstash/master/plugins-filters-split.html](https://www.elastic.co/guide/en/logstash/master/plugins-filters-split.html)

---

<div class="post-metadata">

### Author: ![dm221](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dm221](https://discuss.elastic.co/u/dm221)
#### Post date: [July 26, 2016, 11:52pm UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/5 "2016-07-26T23:52:35Z")

</div>

Respectfully I do not see a way to use the split filter to do what gigvinyl is proposing. Do you prose having a split filter like (this wouldn't work, but at least it's a strawman).:  
split {  
source =\> "foo"  
terminator =\> "},"  
target =\> "bar"  
}  
json {  
source =\> "bar"  
target =\> "abc"  
}

---

<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: [July 27, 2016, 9:23am UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/6 "2016-07-27T09:23:49Z")

</div>

The source field is an array so the `terminator` option doesn't apply. And why would you use a json filter? The original question indicates an array of objects, not an array of JSON strings.

---

<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, 4:46am UTC](https://discuss.elastic.co/t/parsing-a-json-array-of-objects/55441/7 "2017-07-06T04:46:21Z")

</div>


