JSON
JavaScript Object Notation — a textual key-value data format. It is a standard for data exchange between systems, including between LLM and tools.
Example
{
"tool": "web_search",
"query": "what is RAG",
"limit": 5
}
Why Important in AI
During function calling, the model returns a tool invocation in JSON format. The argument schema is described in JSON Schema.
Integration with Tool Calling
- Developer describes the tool (name, description, parameters) in JSON Schema.
- Model generates JSON with arguments.
- Application parses JSON and calls the real function.
Typical Issues
- Model generates JSON with extra text around — use JSON mode (structured output);
- Invalid JSON — catch with parser and ask the model to fix;
- Extra fields — validate against the schema.