# Extract text from a response

**URL:** <https://community.openai.com/t/extract-text-from-a-response/3513>\
**Category:** API\
**Created:** [May 28, 2021, 2:22pm UTC](https://community.openai.com/t/extract-text-from-a-response/3513 "2021-05-28T14:22:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detective](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/detective/32/309_2.png) [@Detective](https://community.openai.com/u/Detective)\
**Post date:** [May 28, 2021, 2:22pm UTC](https://community.openai.com/t/extract-text-from-a-response/3513/1 "2021-05-28T14:22:47Z")

</div>

How can I extract text from a response?

**Response:**

```auto
{
  "choices": [
    {
      "finish_reason": "length",
      "index": 0,
      "logprobs": null,
      "text": "\u00a0test = []\n"
    }
  ],
  "created": 1622211500,
  "id": "cmpl-34XbYobrBu8EY1Egln9g1Doj3NEZM",
  "model": "ada:2020-05-03",
  "object": "text_completion"
}

```

_python_\*

---

<div class="post-metadata">

**Author:** ![joey](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/joey/32/41_2.png) [@joey](https://community.openai.com/u/joey)\
**Post date:** [May 28, 2021, 2:43pm UTC](https://community.openai.com/t/extract-text-from-a-response/3513/2 "2021-05-28T14:43:46Z")

</div>

You can try `response["choices"][0]["text"]`

---

<div class="post-metadata">

**Author:** ![Detective](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/detective/32/309_2.png) [@Detective](https://community.openai.com/u/Detective)\
**Post date:** [May 28, 2021, 2:50pm UTC](https://community.openai.com/t/extract-text-from-a-response/3513/3 "2021-05-28T14:50:27Z")

</div>

Thank you so much : )

---

<div class="post-metadata">

**Author:** ![Geekpulp](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/geekpulp/32/4179_2.png) [@Geekpulp](https://community.openai.com/u/Geekpulp)\
**Post date:** [July 30, 2021, 3:43am UTC](https://community.openai.com/t/extract-text-from-a-response/3513/4 "2021-07-30T03:43:44Z")

</div>

I’m finding my result comes back empty

It looks something like this:

{ text: ‘’, index: 0, logprobs: null, finish\_reason: ‘stop’ }
