# Parse a document with Painless

**URL:** <https://discuss.elastic.co/t/parse-a-document-with-painless/264182>\
**Category:** Kibana\
**Created:** [February 12, 2021, 9:24pm UTC](https://discuss.elastic.co/t/parse-a-document-with-painless/264182 "2021-02-12T21:24:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [February 12, 2021, 9:24pm UTC](https://discuss.elastic.co/t/parse-a-document-with-painless/264182/1 "2021-02-12T21:24:45Z")

</div>

Hello,

In my index i have the field http.request.body.original (see also image below):

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/9/79cf5ba769fc6b0c952fdb2eec0f628bfe95af04.png)

{"customerNr":"9203521","sendMethod":"TOUR","partialDelivery":false,"isTourTimetable":false,"deliveryAddressId":"8100000000000154802","items":[{"articleId":1001440486,"quantity":1},{"articleId":1001532184,"quantity":1}]}

Can someone provide me a painless script so that i can parse the previous doc in the following form below:

customerNr: 9203521  
sendMethod: TOUR  
partialDelivery: false  
isTourTimetable: false  
deliveryAddressId: 8100000000000154802  
item1: 1001440486  
quantity1: 1  
item2: 1001532184  
quantity2: 1

Thank you a lot in advance

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [February 15, 2021, 1:25pm UTC](https://discuss.elastic.co/t/parse-a-document-with-painless/264182/2 "2021-02-15T13:25:06Z")

</div>

This question has been asked before here: [How to convert a json format string to json object using painless script kibana](https://discuss.elastic.co/t/how-to-convert-a-json-format-string-to-json-object-using-painless-script-kibana/210684)

---

<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 15, 2021, 1:25pm UTC](https://discuss.elastic.co/t/parse-a-document-with-painless/264182/3 "2021-03-15T13:25:57Z")

</div>

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