Fix OpenAI JSON Crash in FastAPI Endpoint
Budget: $70.0
FIXED /
⭐ 4.77 (120)
United States
api-development, json, javascript, node.js, api
Hi,
One endpoint in my FastAPI app sometimes crashes when parsing OpenAI responses.
The issue is simple:
json.loads() occasionally fails because the model returns invalid JSON.
I just need this made stable.
What I need:
Handle invalid JSON safely (no crashes)Return a clear error message instead of a server errorRetry once if the response is invalidThat’s it.
App is already working otherwise.
Apri su Upwork