How to format ai output to always be json safe?

Hey guys,

I currently have a make scenario that connects to my front end using a webhook, the dynamic inputs are then passed to my chosen ai via http, the output is json parsed to isolate the message, and that message is mapped via a return webhook.

I have the issue of the ai using markdown formatting that breaks json and ultimately my return output. Is there a simple module/method to ensure near 100% valid json formatting? Prompting alone isn’t enough.

Any insights are welcome! Thank you.

Hey @deaiguy,

you will need to use the ‘Create a JSON’ module. Search for ‘JSON’ in the scenario list and then define what you want to want to respond to your webhook. You can simply put the result of this module into the response module.

Best,
Richard

Thank you Richard, should this be placed after the json parser and before the webhook return? So the hierarchy would be:

Webhook → http → json parse → create json → return webhook?

Yeah that sounds about right! :slight_smile:
In the HTTP Module you can choose “parse output” this way you don’t need the ‘json parse’ step :slight_smile: