Skip to content

Commit f599693

Browse files
Correct the wrong example about JSON source generator in the readme (#1983)
Co-authored-by: Chris Pulman <chris.pulman@yahoo.com>
1 parent b0bd79a commit f599693

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,9 @@ public class Foo
501501
To apply the benefits of the new [JSON source generator](https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/) for System.Text.Json added in .NET 6, you can use `SystemTextJsonContentSerializer` with a custom instance of `RefitSettings` and `JsonSerializerOptions`:
502502

503503
```csharp
504-
var options = new JsonSerializerOptions() {
505-
TypeInfoResolver = MyJsonSerializerContext.Default
506-
};
507-
508504
var gitHubApi = RestService.For<IGitHubApi>("https://api.github.com",
509505
new RefitSettings {
510-
ContentSerializer = new SystemTextJsonContentSerializer(options)
506+
ContentSerializer = new SystemTextJsonContentSerializer(MyJsonSerializerContext.Default.Options)
511507
});
512508
```
513509

0 commit comments

Comments
 (0)