System.Text.Json.JsonException: The JSON value could not be converted to System.DateTime

When deserializing a datetime value with System.Text.Json.JsonSerializer, if the value isn’t in the format it expects, then it’ll throw a JsonException. It expects datetimes to be in the ISO-8601-1:2019 format (for example: 2021-07-12T12:35:34+00:00). For example, the following code is trying to deserialize a datetime value in an unexpected format: This’ll throw the following exception: System.Text.Json.JsonException: … Read more