# JSON codec creating unreadable data

**URL:** <https://discuss.elastic.co/t/json-codec-creating-unreadable-data/116149>\
**Category:** Logstash\
**Created:** [January 19, 2018, 2:24am UTC](https://discuss.elastic.co/t/json-codec-creating-unreadable-data/116149 "2018-01-19T02:24:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [January 19, 2018, 2:24am UTC](https://discuss.elastic.co/t/json-codec-creating-unreadable-data/116149/1 "2018-01-19T02:24:47Z")

</div>

Hi,

For whatever reason the JSON codec suddenly is coding messages in such a way that only the first message in a file is readable.

The forum doesn't allow uploading files so I can't attach the actual file but the file that is uploaded to my S3 is strange. It looks normal when opening it but with notepad++ I can't use any enters. If I copy/paste everything to a new file I can.

```auto
{"@timestamp":"2018-01-19T10:51:05.000Z","error":"error1"}{"@timestamp":"2018-01-19T10:51:06.000Z","hdg":"139.93"}{"lon":"22222.2222,W","speed":"16.06","@timestamp":"2018-01-19T10:51:11.000Z","trck_angl":"138.01","lat":"1111.1111,N"}{"@timestamp":"2018-01-19T10:51:19.000Z","error":"error2"}{"@timestamp":"2018-01-19T10:51:23.000Z","EbNo":"1.2"}
```

ouput

```auto
 s3 {
     codec => "json"
     access_key_id => "secret"
     secret_access_key => "secret"
     region => "eu-west-2"
     bucket => "secret"
     time_file => 1

   }
```

input

```auto
input {
  s3 {
     access_key_id => "secret"
     secret_access_key => "secret"
     region => "eu-west-2"
     bucket => "secret"
     codec => "json"
  }
}
```

I also got a file output with no codec set and output created by that file works fine if I use a file input to read the data.

I've already updated logstash and plugins to the latest version. I have absolutely no clue what to do as I cannot see any errors generated anywhere, the data is just ignored.

I have no idea how to proceed or troubleshoot the issue. Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [January 19, 2018, 6:41am UTC](https://discuss.elastic.co/t/json-codec-creating-unreadable-data/116149/2 "2018-01-19T06:41:41Z")

</div>

Looks like changing the output codec to json\_lines and leaving the input codec as json solved the issue.

---

<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:** [February 16, 2018, 6:42am UTC](https://discuss.elastic.co/t/json-codec-creating-unreadable-data/116149/3 "2018-02-16T06:42:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
