Hi there,
I’m trying to parse some JSON, but it gives me an empty value. I don’t understand why, as I saw in another thread, the same problem was resolved with this javascript.
Here is the problem that I am facing :
Does anyone have an idea about how I could get the correct data?
Thank you very much!
Hi @RomainMaltrud
I think you are looking for JSON.parse()
Hi @BramKn, thank you very much for your help.
I’ve tried JSON.parse, but still have the same error :
It should work like this.
So Probably something else is wrong. Can you show the input and the workflow?
You’re absolutely right. This is why I don’t understand why it gives me empty values 
This is my workflow :
I’ve asked to ChatGPT to provide me JSON results and I’d like to list the “sujets” items like for example :
[
{
“Id”:“1”,
“nom”:“Définition des OKR”,
“description”:“Explication de ce que sont les OKR et comment ils fonctionnent”
}
]
My problem appears in the last node. Here is the JSON input :
[
{
“message”:
{
“role”:“assistant”,
“content”:
“{ “sujets”: [ { “id”: 1, “nom”: “Définition des OKR”, “description”: “Explication de ce que sont les OKR et comment ils fonctionnent” }, { “id”: 2, “nom”: “Comment établir des objectifs ambitieux mais réalisables”, “description”: “Conseils pour définir des objectifs qui stimulent la croissance tout en étant atteignables” }, { “id”: 3, “nom”: “Comment aligner les OKR avec la stratégie de l’entreprise”, “description”: “Méthodes pour s’assurer que les objectifs individuels soutiennent les objectifs globaux de l’entreprise” }, { “id”: 4, “nom”: “Comment mesurer le succès des OKR”, “description”: “Indicateurs clés de performance à utiliser pour suivre la progression vers les objectifs fixés” }, { “id”: 5, “nom”: “Comment impliquer tous les membres de l’équipe dans le processus d’OKR”, “description”: “Stratégies pour encourager la participation et l’engagement de tous les membres de l’équipe dans la définition et la réalisation des OKR” }, { … } ] }”
},
“finish_reason”:
“stop”,
“index”:
0
}
]
Hey @RomainMaltrud,
Is that the full input data? My first thought is maybe the json is invalid.
Hey @Jon,
Thanks for your answer (and thank for all your answer - you’ve already helped me a lot in other threads).
Correct, this is the full input data generated by Chatgpt.
You mean that this part of the Json is invalid ?
“{ “sujets”: [ { “id”: 1, “nom”: “Définition des OKR”, “description”: “Explication de ce que sont les OKR et comment ils fonctionnent” }, { … } ] }"
Hey @RomainMaltrud,
Yeah so that has {…} in it which may not be valid.