# Parsing JSON

**URL:** <https://discuss.elastic.co/t/parsing-json/314435>\
**Category:** Logstash\
**Created:** [September 14, 2022, 3:26pm UTC](https://discuss.elastic.co/t/parsing-json/314435 "2022-09-14T15:26:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [September 14, 2022, 3:26pm UTC](https://discuss.elastic.co/t/parsing-json/314435/1 "2022-09-14T15:26:52Z")

</div>

I want to extract only JSON data but don't know how to do it

```auto
2022-09-14 10:08:37,597 DEBUG logging.RequestLoggingAdvice Request received=[{
"Name" : "John",
"var1" : "Value1",
"var2" : "Value2",
"var3" : "Value3",
"var4" : "Value4",
"var5" : "Value5",
"var6" : "Value6",
"var7" : "Value7",
"var8" : "Value8",
"var9" : "Value9",
"address": {
"city" : "abc",
"country" : "ghj",
}
}]

```

I tried to use grok pattern but it does not give that result which i want.

---

<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:** [September 14, 2022, 3:40pm UTC](https://discuss.elastic.co/t/parsing-json/314435/2 "2022-09-14T15:40:11Z")

</div>

You would need to use a multiline code on the input to consume all those lines as one event, then you could use a grok filter to pick out everything between the square brackets `\[%{GREEDYDATA:someField}\]`, then use a json filter to parse it.

---

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [September 14, 2022, 5:39pm UTC](https://discuss.elastic.co/t/parsing-json/314435/3 "2022-09-14T17:39:21Z")

</div>

> [@Badger](#):
>
> [%{GREEDYDATA:someField}]

Hi @Badger thank you for replying me  
`\[%{GREEDYDATA}\]\:%{GREEDYDATA}%{SPACE}%{GREEDYDATA:message}%{SPACE}%{GREEDYDATA:message}` this not efficient because we get more/less field in jSON  
Is there any other way

---

<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:** [October 12, 2022, 5:39pm UTC](https://discuss.elastic.co/t/parsing-json/314435/4 "2022-10-12T17:39:42Z")

</div>

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