OpenAI Image Analysis to JSON doesn't give raw JSON

Hi there, I wonder if anyone has any thoughts or experience with this.

My scenario takes an emailed image and passes it to the OpenAI ChatGPT Analyse Image module to extract data for a google sheet.

The picture is an image of a treadmill screen and I’m looking to extract time and distance. The prompt asks for the output to be JSON:

{
“Time”: “00:30:00”,
“Distance”: “3.86”
}

It has been working fine for a while now, but recently started giving this:

json
{
“Time”: “00:30:00”,
“Distance”: “4.05”
}

If I use the same prompt in ChatGPT via the app or the web interface, I get the desired result. Same ChatGPT model (4o), same prompt.

I need to get rid of that ‘json’ at the start as the JSON parser can’t work with it.

The prompt is:


This is an image of a treadmill screen. I need to extract specific data and format it as JSON. Follow these instructions carefully: 1. Identify the duration of the exercise (time), which is displayed in the top left corner of the screen in minutes and seconds (mm:ss). Convert this value to the hh:mm:ss format. 2. Identify the distance ran, which is displayed in the bottom right corner of the screen under “Pulse/Distance.” Extract this value as a decimal number.Output the result only as a JSON object, formatted exactly like the following example:

{
“Time”: “hh:mm:ss”,
“Distance”: “00.00”
}

Ensure:
• The Time field always uses the hh:mm:ss format, even if hours are zero.
• The Distance field always shows two decimal places.
• Do not include any text, comments, or explanations outside of the JSON object.

The output must begin and end with curly brackets {}.

I have another scenario essentially doing the same thing for tax receipts and it’s working okay.

I’ve passed the prompt back to ChatGPT to ask it to self-resolve the issue, but to no avail either.

Hoping the brains trust here might have a smart idea as to how to iron out this crease.

Thanks in advance