Property ordering and supported types for structured JSON output with Gemini #12553
SeyitcanOz
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
JSON Property Ordering and Dictionary Support Issues with Gemini APIs
Issue Summary
I'm experiencing two related issues when working with structured outputs and the Gemini API integration:
JsonPropertyOrder
attributes are not being respected in the outputDictionary<TKey, TValue>
properties results in "bad request" errors from Gemini APIEnvironment
Code Example
Here's my model class with
JsonPropertyOrder
attributes:Questions
1. JSON Property Ordering
The
JsonPropertyOrder
attributes don't seem to affect the actual JSON output order when using Gemini APIs. The properties appear in a different order than specified.JsonPropertyOrder
supported with the current Gemini API integration?2. Dictionary Support
When I include
Dictionary<string, object>
or similar dictionary properties in my response models, I consistently receive "bad request" errors from the Gemini API.Expected Behavior
JsonPropertyOrder
Actual Behavior
Additional Context
This affects the reliability of my structured outputs, especially when property order matters for downstream processing or when I need flexible key-value data structures.
Any guidance on these issues would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions