Skip to content

Commit

Permalink
Mention DataAnnotations attribute as an option (dotnet#25503)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdykstra authored Aug 9, 2021
1 parent 6a7c8e0 commit 8438573
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Learn how to migrate from Newtonsoft.Json to System.Text.Json. Inc
author: tdykstra
ms.author: tdykstra
no-loc: [System.Text.Json, Newtonsoft.Json]
ms.date: 07/21/2021
ms.date: 08/06/2021
zone_pivot_groups: dotnet-version
helpviewer_keywords:
- "JSON serialization"
Expand Down Expand Up @@ -603,6 +603,8 @@ The required properties converter would require additional logic if you need to
* A property for a non-nullable type is present in the JSON, but the value is the default for the type, such as zero for an `int`.
* A property for a nullable value type is present in the JSON, but the value is null.

**Note:** If you're using System.Text.Json from an ASP.NET Core controller, you might be able to use a [`[Required]`](xref:System.ComponentModel.DataAnnotations.RequiredAttribute) attribute on properties of the model class instead of implementing a System.Text.Json converter.

### Specify date format

`Newtonsoft.Json` provides several ways to control how properties of `DateTime` and `DateTimeOffset` types are serialized and deserialized:
Expand Down

0 comments on commit 8438573

Please sign in to comment.