# Parsing error when reading from redis

**URL:** <https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198>\
**Category:** Logstash\
**Created:** [June 25, 2018, 7:06am UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198 "2018-06-25T07:06:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cowensel](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@cowensel](https://discuss.elastic.co/u/cowensel)\
**Post date:** [June 25, 2018, 7:06am UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/1 "2018-06-25T07:06:05Z")

</div>

I am seeing the following error when reading a Json event from Redis. 'Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"log4net-2018.06.25", :\_type=\>"test", :\_routing=\>nil}, #LogStash::Event:0x4d91924e], :response=\>{"index"=\>{"\_index"=\>"log4net-2018.06.25", "\_type"=\>"test", "\_id"=\>"Re6\_NWQB00WvXcASSa5s", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"object mapping for [JSONObject] tried to parse field [JSONObject] as object, but found a concrete value"}}}}'.

The event I believe the error is occurring on is {  
"host": "1",  
"sysloglevel": 7,  
"timestamp": "1529563119.65299",  
"LoggerName": "Program",  
"line": "33",  
"JSONObject": {  
"Name": "theName",  
"Description": "theDescription"  
},  
"message": "See JSONObject",  
"Environment": "local",  
"Level": "DEBUG",  
"accountId": "262",  
"employeeId": "231123"  
}

Can anyone assist with getting to the root of the error.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 25, 2018, 11:41am UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/2 "2018-06-25T11:41:52Z")

</div>

I don't think that's the offending event. I think you have another event where JSONObject is e.g. a string (or some other non-object type).

What's the mapping of the JSONObject field in Elasticsearch? Use the get mapping API.

---

<div class="post-metadata">

**Author:** ![cowensel](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@cowensel](https://discuss.elastic.co/u/cowensel)\
**Post date:** [June 25, 2018, 12:33pm UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/3 "2018-06-25T12:33:58Z")

</div>

Interesting you say that, I do have 2 events that pass out the below in the jsonobject the fields contain a forward slash before the quotations.  
"JSONObject": "[{ "mykey": "myvalue" }, { "mykey2": "myvalue2" }, { "Message": "my message hello world" }, { "IntegerValue": "123" }]",

Your help is muchly appreciated.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 25, 2018, 1:12pm UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/4 "2018-06-25T13:12:10Z")

</div>

In _this_ example JSONObject is clearly a string.

---

<div class="post-metadata">

**Author:** ![cowensel](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@cowensel](https://discuss.elastic.co/u/cowensel)\
**Post date:** [June 27, 2018, 1:03pm UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/5 "2018-06-27T13:03:40Z")

</div>

Have you got any recommendations on how we handle Json objects in ES?

![](https://us1.discourse-cdn.com/elastic/original/2X/f/f464dd1c7c382c015b3fc53eebe1cd1aadffee61.jpg)

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 27, 2018, 1:25pm UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/6 "2018-06-27T13:25:23Z")

</div>

I don't understand your question.

---

<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:** [July 25, 2018, 1:25pm UTC](https://discuss.elastic.co/t/parsing-error-when-reading-from-redis/137198/7 "2018-07-25T13:25:27Z")

</div>

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