I’m currently working on an application where I’m using an external API (OpenAI’s API) that returns data as a JSON string. The API is properly set up and functioning as expected, returning responses in the following format:
“Problem1”: “Difficult navigation and customization of settings”,\n “Quote1”: “Well, to be honest, it wasn’t very user-friendly. I found it hard to navigate and customize the settings to my preferences.”,\n “Problem2”: “Overwhelmed by the number of options and cluttered interface”,\n “Quote2”: “When I first signed up for Loom, I was overwhelmed by the number of options available. The interface also felt cluttered, and it was hard to find the specific settings I needed.”,\n “Problem3”: “Issues with video quality and limited optimization options”,\n “Quote3”: “One thing I noticed was that the video quality wasn’t as good as I expected. It would be great if there were more options for optimizing the video quality.”,\n “Problem4”: “Technical difficulties during recording process, like audio issues and video quality drops”,\n “Quote4”: “Yes, there were a few issues. At one point, the audio cut out and I had to stop and start over again. And there were a few times where the video quality dropped unexpectedly.”,\n “Problem5”: “Lack of video editing options, such as annotations or captions”,\n “Quote5”: “I think it would be helpful if there were more options for editing the videos after they’ve been recorded. It would be great if I could add annotations or captions to the videos to make them more informative.”\n}"
The ‘content’ field in the response contains a JSON-formatted string that I want to parse and use to update fields in a data type within my application. The data type has fields corresponding to the keys in the JSON string (Problem1, Quote1, Problem2, Quote2, etc.).
I am currently struggling to find an efficient way to parse this JSON string and use the values within a workflow without resorting to regex or similar methods. I tried creating a plugin that would take the JSON string and return an action that could be used in the workflow, but I encountered issues with undefined or empty input.
I would appreciate any advice or guidance on how to best approach this problem. How can I efficiently parse the JSON string and use the values in a workflow to update fields in a data type?
Thank you in advance for your help!