← All projects
Project record1 mention
Originally shared on Hacker News

GBNF to JSON Schema Translator

This tool translates GBNF grammars into JSON schemas so that structured responses from LLMs can be serialized back into strings conforming to the original grammar. It evaluates which major LLM providers produce stable structured output, since some generated JSON schemas currently break generation and return syntactically invalid JSON. The end goal is generating strings conforming to non-JSON grammars for common formats like CSV, SQL, Python, sed, and regex.

Last shared
01 / The problem

What it addresses

Even when using structured output, some generated JSON schemas break the LLM generation process so that syntactically invalid JSON is returned.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. GBNF to JSON Schema Translator

    This tool translates GBNF grammars into JSON schemas so that structured responses from LLMs can be serialized back into strings conforming to the original grammar. It evaluates which major LLM providers produce stable structured output, since some generated JSON schemas currently break generation and return syntactically invalid JSON. The end goal is generating strings conforming to non-JSON grammars for common formats like CSV, SQL, Python, sed, and regex.

    Problem: Even when using structured output, some generated JSON schemas break the LLM generation process so that syntactically invalid JSON is returned.

    Posted by @kelseyfrog · Original source ↗

    Source text · @kelseyfrog · · Source ↗

    A GBNF to json schema translator in such a way that structured responses from LLMs can be serialized back into string confirming to the original grammar.