Storing chatgpt json response and displaying it

Looking for some assistance. I have successfully connected my API with chatgpt and am receiving the response as a json. I am trying to store that json information to my database, containing the following fields: recipe_name, recipe_ingredients (which will be a list of ingredients and their amounts), recipe_instructions, and recipe_notes. How do I parse these different sections from the response I’m receiving, store it to my database, and then display it in the format I’ve designed?

You can setup backend workflow which will take the JSON string as an input and will return these fields: receipe_name, recipe_ingredients etc.

Inside the backend workflow, you need to do operation on the string like :split_by, :find_and_replace like this.

For example you have this response:

recipes: [
    { "name": "Mango Juice", "ingredients": ["Mango", "Sugar", "Water"], ...},
    {"name":...},
    ...
]

So you will first split the text with recipes:[, then take the second item, then split by }, then it will give you all the ingredients as a list like { "name": "Mango Juice", "ingredients": ["Mango", "Sugar", "Water"], ...}, then you need to process the list one by one ie. take first item and further split by "name": in this way you will get each key from the JSON and store it inside the DB.

I suggested backend workflow because its often fast, but you can do this in frontend custom event as well.