# Unable to parse data while doing post to elastisearch

**URL:** <https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039>\
**Category:** Elasticsearch\
**Created:** [April 28, 2017, 5:10pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039 "2017-04-28T17:10:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonal410](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonal410/32/17825_2.png) [@sonal410](https://discuss.elastic.co/u/sonal410)\
**Post date:** [April 28, 2017, 5:10pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039/1 "2017-04-28T17:10:52Z")

</div>

I have have below request which runs fine on Kibana

```auto
PUT /test_sample/user_log/3
{
          "coulmn1": "TEST",
          "coulmn2": """{"coulmn21":{"sessionId":"1234567","caseId":"XYZ","actionId":"myPage"}}""",
          "type": "user_log",
          "created_datetime": "2017-02-15T03:03:47.000Z"
  }

```

But when I try to add data using rest api, I get exception

```auto
[2017-04-28T12:53:53,611][DEBUG][o.e.a.b.TransportShardBulkAction] [test_node] [test_sample][3] failed to execute bulk item (index) BulkShardRequest [[test_sample][3]] containing [index {[test_sample][user_log][1493398433411], source[{"coulmn1": "TEST","coulmn2": """{"coulmn21":{"sessionId":"1234567","caseId":"XYZ","actionId":"myPage"}}""","type": "user_log","created_datetime": "2017-02-15T03:03:47.000Z"}]}]
org.elasticsearch.index.mapper.MapperParsingException: failed to parse
        at org.elasticsearch.index.mapper.DocumentParser.wrapInMapperParsingException(DocumentParser.java:176) ~[elasticsearch-5.3.0.jar:5.3.0]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:613) [elasticsearch-5.3.0.jar:5.3.0]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.3.0.jar:5.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
 at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@38662edf; line: 1, column: 34]
        at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702) ~[jackson-core-2.8.6.jar:2.8.6]
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558) ~[jackson-core-2.8.6.jar:2.8.6]
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456) ~[jackson-core-2.8.6.jar:2.8.6]
        ... 49 more

```

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [April 28, 2017, 5:33pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039/2 "2017-04-28T17:33:17Z")

</div>

The `"""` construct is a kibana only thing. You'd have to do `"{\"column21\":{\"`...

---

<div class="post-metadata">

**Author:** ![sonal410](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonal410/32/17825_2.png) [@sonal410](https://discuss.elastic.co/u/sonal410)\
**Post date:** [April 28, 2017, 5:38pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039/3 "2017-04-28T17:38:03Z")

</div>

I have to pass value for column2 as a string, please suggest

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [April 28, 2017, 5:51pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039/4 "2017-04-28T17:51:10Z")

</div>

Escape the json into a json string.

---

<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 26, 2017, 5:57pm UTC](https://discuss.elastic.co/t/unable-to-parse-data-while-doing-post-to-elastisearch/84039/5 "2017-05-26T17:57:30Z")

</div>

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