# Logstash json parsing

**URL:** <https://discuss.elastic.co/t/logstash-json-parsing/270851>\
**Category:** Logstash\
**Created:** [April 21, 2021, 1:53pm UTC](https://discuss.elastic.co/t/logstash-json-parsing/270851 "2021-04-21T13:53:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey\_RF](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey_rf/32/86484_2.png) [@Andrey\_RF](https://discuss.elastic.co/u/Andrey_RF)\
**Post date:** [April 21, 2021, 1:53pm UTC](https://discuss.elastic.co/t/logstash-json-parsing/270851/1 "2021-04-21T13:53:09Z")

</div>

Hello. I have incoming JSON log. It has nested JSON. I want to parse main JSON and nested. Example:

```json
{
"value": "123",
"nested": {
     "value-two": "555"
  }
}

```

.

I have a filter like this

```auto
json {
   source => "message"
   target => "json"
}
json {
  source => ??? (string type)
}

```

how can I set [json][value-two] if i must to pass string?

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [April 21, 2021, 2:01pm UTC](https://discuss.elastic.co/t/logstash-json-parsing/270851/2 "2021-04-21T14:01:52Z")

</div>

I am not sure what you are trying to do. But here is an example.

**Conf**

```auto
input {
   generator {
     lines => [
          '{
      "value": "123",
      "nested": {
          "value-two": "555"
        }
      }' 
     ]
     count => 1
     codec => json
   } 
}
filter {

    json { source => "message"}

    mutate {
      convert => {
        "[nested][value-two]" => "integer"
      }
    }

}
output {
  stdout { codec => json_lines }
}

```

**Returns**

```auto
{
	"value": "123",
	"host": "Aarons-MBP.domain",
	"sequence": 0,
	"nested": {
		"value-two": 555
	},
	"@version": "1",
	"@timestamp": "2021-04-21T13:58:21.167Z"
}

```

If that doesn't help can you reply on what you are looking to do exactly?

---

<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 19, 2021, 2:02pm UTC](https://discuss.elastic.co/t/logstash-json-parsing/270851/3 "2021-05-19T14:02:14Z")

</div>

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