Natalia Ramirez • almost 2 years ago
Gemini API JSON output includes markers
Hi! I am using the Gemini API with the JSON output so I can use that for my front end part of the application, however I notice that the API is sending the response as follows:
``` json
[Valid JSON output here]
```
The response includes the markdowns so now I need to do quick data cleanup. Which seems counterintuitive since Gemini API is supposed to be easy to use.
Comments are closed.

3 comments
Liam Bolling Manager • almost 2 years ago
So this is something we are aware of. It spits out markdown. For now, add to the system instruction to not allow markdown or filter it out when you get your response.
Natalia Ramirez • almost 2 years ago
thanks, yea I ended up filtering it out on my code, but it threw me for a loop there trying to debug where my app was failing.
Maciej Pulikowski • almost 2 years ago
@Natalia You can use here function calling to avoid extra text or add JSON_MODE (https://developers.googleblog.com/en/gemini-15-pro-now-available-in-180-countries-with-native-audio-understanding-system-instructions-json-mode-and-more/) to request