# 1rgs/jsonformer

A Bulletproof Way to Generate Structured JSON from Language Models

Repository: https://github.com/1rgs/jsonformer
Canonical: https://ross.abutalabs.com/products/jsonformer
Language: Jupyter Notebook
License: MIT
License Family: permissive
Last push: 2024-02-24T22:48:05+00:00

## Health v2 (maintenance only)
Score: 30/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 87
- inputs: {"age_days": 1222, "days_push": 921, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4934, forks 183 (observed 2026-08-28T04:09:02.666774+00:00)

## What it is
Jsonformer is a Python library that wraps Hugging Face causal language models to generate syntactically correct JSON conforming to a given JSON Schema. It fills in fixed structural tokens itself and only delegates content token generation to the model, making structured output reliable.

## Use cases
- generate structured  from a language model
- force an llm to output valid  matching a schema
- extract structured data from text with a local huggingface model
- get reliable  output without prompt engineering or post-processing
- generate nested objects and arrays from small language models

## When to choose
- you use Hugging Face transformer models and need guaranteed schema-valid JSON
- you want structured output from small local models without brittle prompt parsing
- your schemas use numbers, booleans, strings, arrays, and objects

## When to avoid
- you need full JSON Schema support beyond the supported subset
- you use OpenAI or other API-based models with native structured output
- you need actively developed features or broad model backend support

## Facets
- artifact type: library
- maturity: maintenance
- function: llm-inference, serialization, prompt-engineering
- domain: large-language-models, developer-tools
- platform: python
- tags: -schema, structured-output, huggingface, constrained-generation, llm, natural-language-processing

## Member repositories
- 1rgs/jsonformer (main) score 30

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:02.666774+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:17:57.755296+00:00, confidence not recorded.
  - readme: https://github.com/1rgs/jsonformer (fetched 2026-08-28T04:09:02.666774+00:00, sha 6067df3710e9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
