# How to retrieve document in standard json format to store it into string?

**URL:** <https://discuss.elastic.co/t/how-to-retrieve-document-in-standard-json-format-to-store-it-into-string/136937>\
**Category:** Elasticsearch\
**Created:** [June 21, 2018, 9:19pm UTC](https://discuss.elastic.co/t/how-to-retrieve-document-in-standard-json-format-to-store-it-into-string/136937 "2018-06-21T21:19:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suryatejreddy](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Suryatejreddy](https://discuss.elastic.co/u/Suryatejreddy)\
**Post date:** [June 21, 2018, 9:19pm UTC](https://discuss.elastic.co/t/how-to-retrieve-document-in-standard-json-format-to-store-it-into-string/136937/1 "2018-06-21T21:19:20Z")

</div>

When I do Get operation on Index, I get results in the form of  
{  
"took": 3,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 3,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": 67,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "myindex",  
"\_type": "mydoc",  
"\_id": "FzPe\_mMB5I2B23RHOy",  
"\_score": 1,  
"\_source": { ...  
...  
...  
}

But in my java code, I wanted to store this result of GET operation into Json String.

Is there a way that I can do GET operation where I get standard JSON inside \_source. Like when I do get operation I just wanted the output to be like:  
{  
...  
...},  
{....  
...}

thanks,  
Surya

---

<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 19, 2018, 9:19pm UTC](https://discuss.elastic.co/t/how-to-retrieve-document-in-standard-json-format-to-store-it-into-string/136937/2 "2018-07-19T21:19:32Z")

</div>

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