Getting started with jsonschema – Basic example validation schema

{
    "title": "Person",
    "type": "object",
    "properties": {
        "firstName": {
            "type": "string"
        },
        "lastName": {
            "type": "string"
        },
        "age": {
            "description": "Age in years",
            "type": "integer",
            "minimum": 0
        }
    },
    "required": ["firstName", "lastName"]
}

Results

// Valid
{
    "firstName": "Jason",
    "lastName": "Voorhees"
}
// Valid
{
    "firstName": "Jason",
    "lastName": "Voorhees",
    "age": 47
}
// Invalid - no lastName
{
    "firstName": "Jason",
    "age": 47
}
// Invalid - age is not integer
{
    "firstName": "Jason",
    "lastName": "Voorhees",
    "age": "47"
}

if you want to reproduce, please indicate the source:
Getting started with jsonschema – Basic example validation schema - CodeDay