# \_jsonparsefailure on reading json

**URL:** <https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335>\
**Category:** Logstash\
**Created:** [January 27, 2021, 8:17am UTC](https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335 "2021-01-27T08:17:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![logstash123](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@logstash123](https://discuss.elastic.co/u/logstash123)\
**Post date:** [January 27, 2021, 8:17am UTC](https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335/1 "2021-01-27T08:17:14Z")

</div>

Dear community,  
I need to parse a JSON of the following format:

```
{
  "commitId": "xxxxxxx",
  "author": {
    "name": "",
    "email": "",
    "date": ""
  },
  "committer": {
    "name": "",
    "email": "",
    "date": ""
  },
  "comment": "",
  "changeCounts": {
    "Add":,
    "Edit":,
    "Delete":0
  },
  "url": "",
  "remoteUrl": ""
}

```

My pipeline.conf looks like this:

```
input{
	file{
		path => "somepath"
		start_position => "beginning"
		sincedb_path => "nul"
}
}

filter{
	json {
		source => "message"
		}
}

output{
		stdout {codec =>rubydebug}
		elasticsearch {
			hosts =>"http://localhost:9200"
			index => "demo-json"
}

}

```

However I am getting a \_jsonparsefailure error on almost any line of the json.  
My goal is a format like this

```
{
"commitID": "",
"authorName": "",
"date":"",
"comment": ""
}

```

What could the reason for \_jsoparsefailure be and how can I "level up" the nested fields in the next step?

Thank you in advance.

---

<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:** [January 27, 2021, 4:54pm UTC](https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335/2 "2021-01-27T16:54:14Z")

</div>

If your JSON is pretty-printed then see [this](https://discuss.elastic.co/t/how-to-get-json-data-from-aws-s3-bucket/235386/4) post.

---

<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:** [January 27, 2021, 7:03pm UTC](https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335/3 "2021-01-27T19:03:45Z")

</div>

> [@logstash123](#):
>
> ```auto
> "Add":,
> "Edit":,
> 
> ```

Also your JSON example isn't valid. Should look something like below.

```auto
    "Add": "",
    "Edit": "",

```

or if expecting numbers

```auto
    "Add": null,
    "Edit": null,

```

---

<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 24, 2021, 7:03pm UTC](https://discuss.elastic.co/t/jsonparsefailure-on-reading-json/262335/4 "2021-02-24T19:03:55Z")

</div>

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