[GH-ISSUE #8461] Maintain Object Key Order in JSON Schema Outputs #5442

Open
opened 2026-04-12 16:40:38 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @elliottstorey on GitHub (Jan 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8461

Currently, when generating JSON outputs based on a provided schema, the keys in objects do not retain the order specified in the schema. This behavior differs from OpenAI's implementation, where the order of keys is preserved as defined. Maintaining the specified key order is crucial for applications that rely on consistent JSON structures. Implementing this feature would enhance compatibility and predictability of the generated outputs.

Originally created by @elliottstorey on GitHub (Jan 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8461 Currently, when generating JSON outputs based on a provided schema, the keys in objects do not retain the order specified in the schema. This behavior differs from OpenAI's implementation, where the order of keys is preserved as defined. Maintaining the specified key order is crucial for applications that rely on consistent JSON structures. Implementing this feature would enhance compatibility and predictability of the generated outputs.
GiteaMirror added the feature request label 2026-04-12 16:40:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5442