Skip to content

Commit 230aa08

Browse files
authored
Fix JsonOptions sample code (#17885)
1 parent c88fae0 commit 230aa08

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

aspnetcore/web-api/advanced/formatting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: ardalis
44
description: Learn how to format response data in ASP.NET Core Web API.
55
ms.author: riande
66
ms.custom: H1Hack27Feb2017
7-
ms.date: 12/05/2019
7+
ms.date: 04/17/2020
88
uid: 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
124124
services.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

0 commit comments

Comments
 (0)