Markdown within my json output

Since I have wanted the output format to be a json, I cannot get the formatting within the json to work. I have multiple keys in the output json and the main one called message is a long text but it doesn’t have any formatting to it. My prompt has the following example of output

...
**Sample successful answer**
{
"message": "Your detailed response with inline citations like [1], [2], … up to [M], where M≤K.",
"references": [
{
"name": "Exact document title",
"section": "Section ID or number",
...
}
// … total of M entries, element 1 maps to [1], etc. …
]
}

How can I have the message to be markdown formatted?

1 Like

Here is an example:

give me a description about the sun. answer only with a json with these keys:
- name
- galaxy
- article: write a small article formatted with markdown

output:

{
  "name": "Sun",
  "galaxy": "Milky Way",
  "article": "## The Sun: Our Life-Giving Star\n\nThe **Sun** is a G-type main-sequence star (G2V) located at the center of our solar system. It is by far the largest and most massive object in the solar system, containing more than 99.8% of its total mass. \n\nComposed primarily of hydrogen (about 74%) and helium (about 24%), the Sun generates energy through nuclear fusion, converting hydrogen into helium in its core. This process releases vast amounts of energy, which radiates outward and supports life on Earth by providing light and heat.\n\nThe Sun is located in the **Milky Way** galaxy, specifically in the Orion Arm, about 26,000 light-years from the galactic center. It is approximately 4.6 billion years old and is expected to continue shining for another 5 billion years before evolving into a red giant and eventually a white dwarf.\n\nUnderstanding the Sun is crucial not only for studying the solar system but also for gaining insights into the behavior of other stars throughout the universe."
}
4 Likes