This seems like its going to be more of a need with all the AI wrapper apps popping up recently.
I have an issue where I prompt an AI API to do some magic and respond with JSON format, the problem is that it only works maybe 50% of the time, the rest the JSON.parse() fails due to some sort of Unexpected token
.
Does anybody know of a safe wrapper to parse JSON ? it would ideally work as a sort of try and catch recursive function where if it fails, it formats the unexpected token and then calls itself with the better version.