JDogo
Open playground

Integrations

Drop JDogo into the stack you already run.

HTTP APIs

Clients send Accept: application/jdogo to get JDogo instead of JSON. Request bodies with Content-Type: application/jdogo are decoded for you. Everyone else keeps getting JSON.

from fastapi import FastAPI
from jdogo import JDogoFastAPIMiddleware

app = FastAPI()
app.add_middleware(JDogoFastAPIMiddleware)

The starter is a standard Spring Boot 3 auto-configuration. It adds a JDogoMapper bean built from jdogo.* settings and, in a Spring MVC app, a message converter placed after Jackson: a client that sends Accept: application/jdogo gets JDogo, every other client keeps JSON. See Java guide: Spring Boot for every setting.

DataFrames

import pandas as pd
import jdogo
jdogo.register_pandas_accessor()

df = pd.DataFrame(rows)
text = df.jdogo.encode()
card = df.jdogo.schema_card()
answer = df.jdogo.ask("How many orders are late?", llm=call_model)

back = jdogo.to_dataframe(text)          # pandas, or library="polars"

Agents and tools

Run the tools a model asked for and get back the exact messages the OpenAI or Anthropic SDK expects, with every result written as JDogo. A tool that throws returns its error to the model instead of crashing the loop. Add TOOL_FORMAT_NOTE to the system prompt once.

from jdogo import providers

# OpenAI Chat Completions
msg = reply.choices[0].message
messages += [msg, *providers.run_openai_tool_calls(msg, {"search_orders": search_orders})]

# Anthropic Messages
messages.append({"role": "assistant", "content": reply.content})
messages.append(providers.run_anthropic_tool_uses(reply.content, {"search_orders": search_orders}))

For one result at a time: openai_tool_message(id, result), anthropic_tool_result(id, result) and compact_result(result) (openAIToolMessage, anthropicToolResult, compactResult in TypeScript). Small results that are shorter as JSON stay JSON.

from jdogo import JDogoDocumentCompressor, JDogoOutputParser

context = JDogoDocumentCompressor().compress_documents(docs)
parser = JDogoOutputParser(fields=["id", "label"])

Jackson

ObjectMapper mapper = new ObjectMapper();
var codec = new JDogoTreeCodec(mapper);

String text = codec.toJDogo(mapper.readTree(json));                 // compact document
String typed = codec.toJDogo(mapper.readTree(json), FormatMode.TYPED);
JsonNode node = codec.fromJDogo(text);                              // also reads typed text and plain JSON

Local models

Generate a GBNF grammar from sample data and pass it to llama.cpp, Ollama or vLLM. The model can then only emit rows with your columns.

jdogo gbnf sample.json -o rows.gbnf

Media types

TypeBody
application/jdogoCompact document (the SDK middleware)
application/jdogo+typedTyped document
application/x-jdogoName used by the specification and the Spring converter