- Optional (not in
required): the key may be absent entirely. This means “we didn’t ask” or “not applicable.” - Nullable (
type: ["string", "null"]): the key is always present, but the value may benull. This means “we asked, but the answer is unknown.”
Use case
CRM contact records wherenickname is a nice-to-have that the model may or may not extract (optional), but middle_name should always be present in the output and set to null when the source text doesn’t mention one.
Schema pattern
Example outputs
Known middle name, no nickname:Why this works
In the first example,nickname is absent. The model didn’t extract one, and your application can skip rendering it entirely. In the second example, middle_name is explicitly null. The model looked for a middle name and didn’t find one, so your UI can show “Unknown” instead of leaving a blank gap.
This distinction is especially important for analytics and data pipelines. A COUNT of non-null middle_name values tells you how many contacts have known middle names. A COUNT of records where nickname exists tells you how many contacts provided one. Without the distinction, both queries return the same misleading number.