JSON schema

Also called JSON Schema, input_schema

A written contract for a JSON record: which fields it has, the type of each, which are required, and which values are allowed.

A JSON schema describes a record before it exists. It lists the fields, gives each a type such as string, integer or array, marks which ones must be there, and can limit a field to a set of allowed values.

When you build with Claude, it's how you tell the model the exact shape you need back. Give a tool a schema as its input, and Claude's call fills it in. Design matters: a field marked required gets filled even when the document has nothing for it, so a field the source may lack should allow null instead.

For example

An extraction tool's schema says a paper has a title, a list of authors and a year that's an integer, and that funding_source may be null.

WITH PLUS

Put it to use

Where you'll meet JSON schema in ChatGPT, Gemini and Claude, how to use it there, and the mix-up most people make.

Daily Bytes Plus is in the Android app.