Skip to content

Expanded JSON-LD

Purpose

The expanded module provides a BaseModel class based on the BaseModel of pydantic. Using this base class, one can define models for JSON-LD data in expanded form such that any existing data can be validated and instantiated as a model instance. Additionally, model instances can be manually created and dumped as compact JSON-LD data.

from pydantic_jsonld.expanded import BaseModel, Field, Value


class MyModel(BaseModel):
    value: Value[int] = Field(..., prefix="http://www.example.com/")

Keywords

The only supported keywords are @direction, @id, @index, @language, @type, and @value.

Most notably, @list and @set are not supported as of now.