File tree Expand file tree Collapse file tree
aspnetcore/web-api/advanced Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ author: ardalis
44description : Learn how to format response data in ASP.NET Core Web API.
55ms.author : riande
66ms.custom : H1Hack27Feb2017
7- ms.date : 12/05/2019
7+ ms.date : 04/17/2020
88uid : web-api/advanced/formatting
99---
1010# Format response data in ASP.NET Core Web API
@@ -124,10 +124,10 @@ Features for the `System.Text.Json`-based formatters can be configured using `Mi
124124services .AddControllers ().AddJsonOptions (options =>
125125{
126126 // Use the default property (Pascal) casing.
127- options .SerializerOptions .PropertyNamingPolicy = null ;
127+ options .JsonSerializerOptions .PropertyNamingPolicy = null ;
128128
129129 // Configure a custom converter.
130- options .SerializerOptions .Converters .Add (new MyCustomJsonConverter ());
130+ options .JsonSerializerOptions .Converters .Add (new MyCustomJsonConverter ());
131131});
132132```
133133
@@ -166,7 +166,7 @@ services.AddControllers().AddNewtonsoftJson(options =>
166166 options .SerializerSettings .ContractResolver = new DefaultContractResolver ();
167167
168168 // Configure a custom converter
169- options .SerializerOptions .Converters .Add (new MyCustomJsonConverter ());
169+ options .SerializerSettings .Converters .Add (new MyCustomJsonConverter ());
170170});
171171```
172172
You can’t perform that action at this time.
0 commit comments