Send message to ChatGPT - JSON not being returned

Hey team,
I have a GPT node. I’m wanting it to return a json object and I have that ticked:


And I have in the prompt body asking for a Jason format

But the output of the node isn’t itemising the different json keys like I’d expect it to


Am I doing this wrong? Or do I always need to ad a javascript node to parse the json correctly to use it in different fields in future nodes.

Try to add JS node after OpenAI node and ask AI Copilot to parse JSON string, like this: “parse JSON from response of previous node”.
Then click on “Replace button” and “Save & Run”

Yeah and that’s basically what I’ve done. But then I don’t get what the point of the response format checkbox is in that case:

It’s not like it’s even injecting anything into the query asking for a json formatted response because in the description it says I still need to request that in the prompt. So I can’t tell what difference that response format option does?

This is less a Latenode question than an OpenAI issue. Check out https://platform.openai.com/docs/guides/structured-outputs#json-mode

Ahh I see.

Would be handy though if that box was ticked then Latenode assumed the response was going to be JSON and parsed it in the node. Can’t imagine any instance where you’d ask it for a JSON response but not want to parse it unless I guess you were wanting to just inject JSON into a table or something but then you could take it from a higher tree level.

Hi @dhtbrowne !

To ensure that GPT always returns valid and readable JSON, I recommend using a combination of GPT and JSON parse.
Uploading: brave_oR2wkZvdjt.png…

Additionally, a crucial point is that, besides asking GPT to return data in JSON format, you should provide it with an example of the exact JSON structure you expect.
Uploading: brave_oR2wkZvdjt.png(1)…


This approach works flawlessly, and I use it in numerous automation scenarios.

Have noticed you’ve added a parsed json object option! Nice :smiley:

Yes, our developers did a great job! This has become much more convenient