How to use the JSON to OpenAI Function Schema Generator
1. Paste a sample JSON object that represents the function's expected parameters.
2. Set the function name and description — these guide the model on when to call it.
3. Copy the generated schema to use in your OpenAI API tools array.
What is it?
OpenAI function calling (now called "tools") lets LLMs call your code with structured arguments instead of generating free-form text. The model receives a schema describing your functions and decides when and how to call them. Writing these JSON schemas by hand is tedious — this tool generates them from a sample JSON object in one click.
The generated schema follows the JSON Schema Draft-07 format that OpenAI's API expects. All fields from your sample JSON become required parameters with inferred types. After generating, add description fields to each parameter to help the model understand what values to pass — good descriptions dramatically improve function-calling accuracy.
Example
{"name":"Alice","age":30,"active":true}{
"type": "function",
"function": {
"name": "process_user",
"description": "...",
"parameters": {
"type": "object",
"properties": {
"name": {"type":"string","description":"name"},
"age": {"type":"integer","description":"age"},
"active": {"type":"boolean","description":"active"}
},
"required": ["name","age","active"]
}
}
}Add clear descriptions to each property — the model uses them to decide what value to pass.
Benefits
Generate OpenAI function calling schema from a JSON example in one click
Building function schemas by hand is error-prone — generate from a real JSON sample and get a correct schema immediately.
Compatible with Claude and Gemini tool use schemas
The generated schema format works with all major LLM function-calling and tool use APIs — not just OpenAI.
Start with a correct schema rather than debugging one you wrote manually
A schema generated from a real JSON example is structurally correct by construction — not by iteration and testing.
Test your function calling setup by matching output to schema
Verify that the JSON your function returns matches the schema you're sending to the LLM — catch type mismatches before deployment.
Frequently asked questions
What is the difference between functions and tools in OpenAI?
OpenAI renamed the 'functions' parameter to 'tools' in newer API versions. The schema format is the same — wrap your function schema in {type: 'function', function: {...}}. The old functions parameter still works but is deprecated.
How do I handle optional parameters?
Remove the field from the required array to make it optional. Properties listed in required must be provided; properties not in required can be omitted by the model. For optional fields, also add a description explaining when they should be provided.
Can I have multiple function schemas?
Yes — pass an array of tool objects to the tools parameter. The model will choose which function to call based on the descriptions. Provide one function per distinct operation for best results.