# Unexpected character while posting a payload to elastic search via rest client

**URL:** <https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 12, 2023, 6:05pm UTC](https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802 "2023-06-12T18:05:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tukaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tukaram/32/118944_2.png) [@Tukaram](https://discuss.elastic.co/u/Tukaram)\
**Post date:** [June 12, 2023, 6:05pm UTC](https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802/1 "2023-06-12T18:05:22Z")

</div>

Hi,

Hi, I am using 7.17.3 stack for elastic. Low level Elasticsearch rest client is from 7.15.2  
I am trying to send a payload having special characters in it using the below code.

Request request = new Request("PUT", ELASTIC\_ENDPOINT + elasticUniqueID);  
request.setEntity(new NStringEntity(message, ContentType.APPLICATION\_JSON));

I am some time getting this error -  
ine [HTTP/1.1 400 Bad Request]  
{"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"failed to parse"}],"type":"mapper\_parsing\_exception","reason  
":"failed to parse","caused\_by":{"type":"i\_o\_exception","reason":"Unexpected character (',' (code 44)): expected a value  
n at [So  
urce: (ByteArrayInputStream); line: 1, column: 2803]"}},"status":400}

How I can write any type of string using the simple JSON object?

---

<div class="post-metadata">

**Author:** ![Tukaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tukaram/32/118944_2.png) [@Tukaram](https://discuss.elastic.co/u/Tukaram)\
**Post date:** [June 20, 2023, 9:08am UTC](https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802/2 "2023-06-20T09:08:26Z")

</div>

It seems its trying to combine 2 jsons while sending request and hence getting , between those 2 jsons. How I can force it to post single json at a time?

---

<div class="post-metadata">

**Author:** ![Tukaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tukaram/32/118944_2.png) [@Tukaram](https://discuss.elastic.co/u/Tukaram)\
**Post date:** [June 22, 2023, 12:53pm UTC](https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802/3 "2023-06-22T12:53:25Z")

</div>

it was my kafka giving multiple jsons to it. can be closed.

---

<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 20, 2023, 12:54pm UTC](https://discuss.elastic.co/t/unexpected-character-while-posting-a-payload-to-elastic-search-via-rest-client/335802/4 "2023-07-20T12:54:14Z")

</div>

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