Parse data from a Json in Json

Troubleshooting

Hello, I am getting a Json from openAI and I chose the json schema format type so that's what I get knowing that I want data from $.choices[:].message.content

{
  "id": "chatcmpl-ALq8DUUrAMCe5k7mqoAnuH1H444",
  "object": "chat.completion",
  "created": 1729768645,
  "model": "gpt-4o-2024-08-06",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "{\"details\":[{\"destRef\":\"/destinations/Tirana\",\"destName\":\"Tirana\",\"weather\":4,\"crowd\":3,\"safety\":4,\"desc\":\"Explorez le Bunk'Art et profitez d'une vue spectaculaire depuis le téléphérique Dajti Ekspres.\",\"budget\":300},{\"destRef\":\"/destinations/Paris\",\"destName\":\"Paris\",\"weather\":3,\"crowd\":4,\"safety\":4,\"desc\":\"Promenez-vous sur les Champs-Élysées et visitez la Cathédrale Notre-Dame.\",\"budget\":400},{\"destRef\":\"/destinations/Amsterdam\",\"destName\":\"Amsterdam\",\"weather\":3,\"crowd\":4,\"safety\":4,\"desc\":\"Profitez d'une croisière romantique sur les canaux et découvrez les musées fascinants.\",\"budget\":400},{\"destRef\":\"/destinations/Stockholm\",\"destName\":\"Stockholm\",\"weather\":3,\"crowd\":3,\"safety\":5,\"desc\":\"Visitez le fascinant ABBA The Museum et admirez les jardins de Botaniska Tradgarden.\",\"budget\":450},{\"destRef\":\"/destinations/Vlore\",\"destName\":\"Vlorë\",\"weather\":4,\"crowd\":3,\"safety\":4,\"desc\":\"Découvrez l'histoire ancienne d'Apollonia Archaeological Park\",\"budget\":250}]}",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 544,
    "completion_tokens": 281,
    "total_tokens": 825,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0
    }
  },
  "system_fingerprint": "fp_a7d06e42a7"
}

I have created a dataType details with the same structure than the json in the json that will be saved in a subcollection "podium"

So I built a loop because to build a document for each item in the list but when I create a document in podium and try to parse from the predefined path, it cannot be selected. So I typed it manually

I tried to save the data through a loop with the method shown in picture 3 and 4 but it returns nothing...

What have you tried so far?

Tried to clean the json with a custom function but not sure it is the issue.

Did you check FlutterFlow's Documentation for this topic?
No
1
3 replies