# Getting response data as a fixed & Consistent JSON response

**URL:** <https://community.openai.com/t/getting-response-data-as-a-fixed-consistent-json-response/28471>\
**Category:** API\
**Created:** [December 31, 2022, 1:22pm UTC](https://community.openai.com/t/getting-response-data-as-a-fixed-consistent-json-response/28471 "2022-12-31T13:22:26Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![mattgscox](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mattgscox/32/34222_2.png) [@mattgscox](https://community.openai.com/u/mattgscox)\
**Post date:** [March 8, 2023, 7:28am UTC](https://community.openai.com/t/getting-response-data-as-a-fixed-consistent-json-response/28471/23 "2023-03-08T07:28:15Z")

</div>

I have tweaked my preferred prompt to give a better response, and specifically say to provide RFC8259 compliant JSON. I have had consistent results using Chat-GPT as with Davinci, although for Chat-GPT I had to also add the instruction not to provide an explanation to consistently only get the JSON without any pre-amble;

**system prompt:**

```plaintext
Pretend you are an expert language translator

```

**user prompt:**

```plaintext
Create a list of three random source phrases and three random translations for each.
Do not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.
[{
  "source_language": "language of original phrase",
  "source_phrase": "the phrase to be translated",
  "translations": [{
    "trans_language": "language of the translation",
    "translation": "the translated phrase"
  }]
}]
The JSON response:

```

This gives a consistent JSON response along the lines of…

```plaintext
[{
  "source_language": "English",
  "source_phrase": "I love pizza",
  "translations": [{
    "trans_language": "Spanish",
    "translation": "Me encanta la pizza"
  },{
    "trans_language": "Italian",
    "translation": "Amo la pizza"
  },{
    "trans_language": "French",
    "translation": "J'adore la pizza"
  }]
},{
  "source_language": "Mandarin",
  "source_phrase": "你好吗？",
  "translations": [{
    "trans_language": "English",
    "translation": "How are you?"
  },{
    "trans_language": "Korean",
    "translation": "어떻게 지내?"
  },{
    "trans_language": "Japanese",
    "translation": "お元気ですか？"
  }]
},{
  "source_language": "Russian",
  "source_phrase": "Я люблю мороженое",
  "translations": [{
    "trans_language": "German",
    "translation": "Ich liebe Eis"
  },{
    "trans_language": "Turkish",
    "translation": "Dondurma seviyorum"
  },{
    "trans_language": "Polish",
    "translation": "Kocham lody"
  }]
}]

```

---

_[View the full topic](https://community.openai.com/t/getting-response-data-as-a-fixed-consistent-json-response/28471)._
