Get json with live internet search [Gemini 2.5 Pro)

Hi, when I enable web search - then using structured api answer is not possible. I accepted it and did it via instructions + promt. But sometimes it doesn’t listen to instructions (when it gives not what I need regarding information, for example, it abbreviates, and when it gives not in json format).

Has anyone encountered this? Maybe it is possible to implement something else on top of it? Some solution from github maybe

Hi @user1648,

Thanks for raising this issue with us. Currently, grounding with Google Search is not possible when structured output is enabled, and vice versa.

Also, I have tried different system instructions with different prompts in Gemini 2.5 Pro, and each time it takes both the system instructions and the prompt(for json output) into account. Please make sure you don’t have a conflict between your system instructions and your prompt. Also, if you could share your prompt and system instructions with me, I can also test it on the model. Thank You!!