How to Parse OPENAI node response

How to parse the repsonse from OpenAI node. I am currently using openAI to classify Bank transactions into Category, Group, and Keyword… I have it set to return a JSON but the returned json is not formatted correctly. I haven’t been able to figure out how to use json or jmespath to correctly parse the data, so i guess my real question is how to use json or jmespath to parse this openai data:


I’m open to any other solution as well, as this part of the workflow is CRUICAL to my project! MUCH thanks in advanced for anyone who spend even a second helping me learn!

Hey @nvenhuizen14,

Try using {{ JSON.parse($json.text) }} in a set node, This will return something like this…

Example workflow to produce some Pineapple based JSON…

1 Like

Thank you for responding!

unfortunately with {{ JSON.parse($json.text) }} i receive undefined :confused:

Is this the same topic as this?

1 Like

yes i apologise. I did not explain my situation well in the last one and couldnt figure out how to delete it

Hey @nvenhuizen14, it seems like your openAI node is not returning correct JSON as it’s missing the outer {}. Try something like this:

1 Like

YUP THAT DID IT! thank you man! that’s been driving me crazy! lol

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.