adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

ADK agent would sometimes return malformed JSON

Open ggae2 opened this issue 1 year ago • 2 comments

Problem Description I encountered intermittent JSON parsing errors when integrating a frontend application with an ADK agent backend. The ADK agent would sometimes return malformed JSON that couldn't be parsed by the frontend, specifically when using visualization tools. Error Details:

Expected ',' or '}' after property value in JSON at position ~4069 Unexpected token 'T', ..."useGeodata": True, "val"... is not valid JSON Error occurred in ADK's stateDelta.visual_result field responses

Architecture:

Backend: ADK Agent (Python) running on adk api_server Frontend: React/Vite app consuming ADK /run endpoint Issue: JSON responses from ADK agent contained somettimes Python formatting instead of valid JSON

Symptoms

Intermittent behavior: Same visualization request would work sometimes, fail other times Python vs JSON format: ADK responses contained someties True/False instead of true/false

anyone had similare issue

ggae2 avatar Jul 20 '25 12:07 ggae2

duplicate. closing.

hangfei avatar Oct 28 '25 20:10 hangfei

Hi, is there any specific way that JSON validation can be solved. I am using output_key with a proper Pydantic model and the model fails. This is intermittent, with more occurrences when using flash vs pro models. But happens every now and then. If there are any guidelines, please can you share?

I am using adk with Python.

lkshay avatar Dec 10 '25 22:12 lkshay