# Best way to parse json input?

**URL:** <https://discuss.elastic.co/t/best-way-to-parse-json-input/29809>\
**Category:** Logstash\
**Created:** [September 22, 2015, 7:43pm UTC](https://discuss.elastic.co/t/best-way-to-parse-json-input/29809 "2015-09-22T19:43:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![CraigFoote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigfoote/32/4571_2.png) [@CraigFoote](https://discuss.elastic.co/u/CraigFoote)\
**Post date:** [September 23, 2015, 2:42pm UTC](https://discuss.elastic.co/t/best-way-to-parse-json-input/29809/5 "2015-09-23T14:42:07Z")

</div>

Based on [https://gist.github.com/shurane/60eee09eeee15a50f289](https://gist.github.com/shurane/60eee09eeee15a50f289), I changed my config to:

```
input{
  exec{
    command => "cat file.json"
    codec => json_lines
    interval => 60
  }
}
output{
  stdout{codec => ruby_debug}
}

```

...with this result:

```
A plugin had an unrecoverable error. Will restart this plugin.
Plugin: <LogStash::Inputs::Exec command=>...
Error: string not matched {:level=>:error}
{
  "message" => "}{\r",
  "tags" => ...
}

```

Am I correct in thinking the json\_lines codec looks for \n and is failing when it comes to a \r?

---

_[View the full topic](https://discuss.elastic.co/t/best-way-to-parse-json-input/29809)._
