For any users who have switched from gpt-3.5-turbo to one of the newer models,
and are making use of the “json mode” the json output will typically be in markdown format and have top and tail markdown markers, i.e. ```json with a closing triple backtick at the end.
You can remove this with a regex parser like this :
response.content = response.content.replace(/```json\n?|```/g, '');