# Logstash JSON Parser is just parsing fields if no target is defined

**URL:** <https://discuss.elastic.co/t/logstash-json-parser-is-just-parsing-fields-if-no-target-is-defined/219205>\
**Category:** Logstash\
**Created:** [February 13, 2020, 1:08pm UTC](https://discuss.elastic.co/t/logstash-json-parser-is-just-parsing-fields-if-no-target-is-defined/219205 "2020-02-13T13:08:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Becker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simon_becker/32/87100_2.png) [@Simon\_Becker](https://discuss.elastic.co/u/Simon_Becker)\
**Post date:** [February 13, 2020, 1:08pm UTC](https://discuss.elastic.co/t/logstash-json-parser-is-just-parsing-fields-if-no-target-is-defined/219205/1 "2020-02-13T13:08:17Z")

</div>

Hello,

I am currently trying to parse a JSON message through the JSON filter. Without defining any target it works perfectly. When adding a target field it is not parsing any more throwing this error:

`response=>{"index"=>{"_index"=>"filebeat-7.5.0", "_type"=>"_doc", "_id"=>"-iuXPnABPP-AmVbj8tut", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [service] of type [text] in document with id '-iuXPnABPP-AmVbj8tut'. Preview of field's value: '{instance=ef92a628-34fb-4007-a3a0-d312cb05f108, logger=CheckService, HealthStatus=Healthy, ElapsedMilliseconds=0.5995[...]`

`{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:308"}}}}}`

My Pipeline:

```
  filter {

          json {

            source => "logsource"

            skip_on_invalid_json => true

            target => "service"

          }

        }

```

When i remove the target =\> "service" it works fine.

I would like to have the fields created like this:  
service.instance  
service.logger  
service.[...]

Does anyone have an Idea what am I doing wrong?

Thank you! 🙂

---

<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:** [March 12, 2020, 1:08pm UTC](https://discuss.elastic.co/t/logstash-json-parser-is-just-parsing-fields-if-no-target-is-defined/219205/2 "2020-03-12T13:08:24Z")

</div>

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