# Parse json if json else leave as is

**URL:** <https://discuss.elastic.co/t/parse-json-if-json-else-leave-as-is/60586>\
**Category:** Logstash\
**Created:** [September 15, 2016, 9:05am UTC](https://discuss.elastic.co/t/parse-json-if-json-else-leave-as-is/60586 "2016-09-15T09:05:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpan](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@arpan](https://discuss.elastic.co/u/arpan)\
**Post date:** [September 15, 2016, 9:05am UTC](https://discuss.elastic.co/t/parse-json-if-json-else-leave-as-is/60586/1 "2016-09-15T09:05:12Z")

</div>

I wanted the filter to parse a message as json if it is json, otherwise just let it be in the form it is. There wasn't a lot of documentation on the filter description page so I was not sure if this is the default behavior already. If not, what is the best way to achieve this result?

---

<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:** [September 17, 2016, 5:46pm UTC](https://discuss.elastic.co/t/parse-json-if-json-else-leave-as-is/60586/2 "2016-09-17T17:46:26Z")

</div>

I suggest installing v3.0.2+ of the plugin and setting `skip_on_invalid_json => true`.

---

<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:38am UTC](https://discuss.elastic.co/t/parse-json-if-json-else-leave-as-is/60586/3 "2017-07-06T04:38:05Z")

</div>


