make System.Text.Json deserializer more strict? It is driving me crazy. I tried every "solution" online and none of them worked.
Let's say I have a data type record SomeData(string title, int price), and I try to deserialize it from some json JsonSerializer.Deserialize<SomeData>(json) it will deserialize without an error on literally any json as long as it is valid json. So title and price can become null which I obviously dont want. I want the deserialization to only succeed if the fields exist in the json. I am using .NET 5 with nullable types enabled
http://json-schema.org/ I think that's what you're looking for
Обсуждают сегодня