# Logstash failing to parse json

**URL:** <https://discuss.elastic.co/t/logstash-failing-to-parse-json/44471>\
**Category:** Logstash\
**Created:** [March 15, 2016, 6:03pm UTC](https://discuss.elastic.co/t/logstash-failing-to-parse-json/44471 "2016-03-15T18:03:22Z")\
**Posts on this page:** 2\
**Page:** 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:** [March 18, 2016, 9:12am UTC](https://discuss.elastic.co/t/logstash-failing-to-parse-json/44471/21 "2016-03-18T09:12:22Z")

</div>

ES indexes the documents exactly as they arrive. It sounds like your problem is that e.g. `event82` contains an array rather than an object, but that's really a problem with the source data. If you want you can use Logstash to transform the input to this:

```auto
"events" : {
  "event82" : {
    "count" : 1,
    "exponent" : 0,
    "unique" : ""
  },
  "event30" : {
    "count" : 1,
    "exponent" : 0,
    "unique" : ""
  },
  ...

```

There's no standard filter for doing that transformation but you can write Ruby code in a ruby filter to do it.

---

<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:06am UTC](https://discuss.elastic.co/t/logstash-failing-to-parse-json/44471/22 "2017-07-06T05:06:30Z")

</div>



[Previous page](https://discuss.elastic.co/t/logstash-failing-to-parse-json/44471.md?page=1)
