# Parsing multiple json in a file

**URL:** https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446
**Category:** Logstash
**Created:** [April 27, 2022, 9:44pm UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446 "2022-04-27T21:44:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![stemons](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stemons/32/84571_2.png) [@stemons](https://discuss.elastic.co/u/stemons)
#### Post date: [April 27, 2022, 9:44pm UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446/1 "2022-04-27T21:44:34Z")

</div>

Hello! I'm trying to parse a file that contains multiple json. Each json is not delimited by a new line or comma separated.

e.g. {"version":"0",....}{"version":"0",...}{"version":"0",...}

parsing with the following codec does not work

codec =\> json\_lines {  
delimiter =\> "^{"version":"  
}

Any suggestion?  
Thanks!

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 28, 2022, 1:45am UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446/2 "2022-04-28T01:45:30Z")

</div>

What input are you trying to use the codec on? You cannot use it on a file input or any other input that eats the newline from each line before sending it to the codec. This is explained in the [documentation](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-json_lines.html#_description_180).

---

<div class="post-metadata">

### Author: ![stemons](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stemons/32/84571_2.png) [@stemons](https://discuss.elastic.co/u/stemons)
#### Post date: [April 28, 2022, 6:58am UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446/3 "2022-04-28T06:58:35Z")

</div>

Hello, the input is a file. I'm wondering how to manage multiple json with the same structure in the same file. json filter is enough?

Thanks

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 28, 2022, 4:35pm UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446/4 "2022-04-28T16:35:06Z")

</div>

As the documentation says, use a json codec, not a json\_lines codec.

---

<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: [May 26, 2022, 4:35pm UTC](https://discuss.elastic.co/t/parsing-multiple-json-in-a-file/303446/5 "2022-05-26T16:35:30Z")

</div>

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