You have to set the P2 property to mandatory with the JsonPropertyAttribute
public class ApiMessage
{
public string P1 { get; set; }
[JsonProperty(Required = Required.Always)]
public string P2 { get; set; }
}
With your example, you will get an JsonSerializationException
.
Hope it helps!