Skip to content

Commit 74f9d5e

Browse files
Update README.md JSON Source Generator (#1793)
JsonSerializerOptions.AddContext is obsolete. (https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions.addcontext?view=net-8.0) Co-authored-by: Chris Pulman <[email protected]>
1 parent c05a599 commit 74f9d5e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,9 @@ public class Foo
495495
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`:
496496

497497
```csharp
498-
var options = new JsonSerializerOptions();
499-
options.AddContext<MyJsonSerializerContext>();
498+
var options = new JsonSerializerOptions() {
499+
TypeInfoResolver = MyJsonSerializerContext.Default
500+
};
500501

501502
var gitHubApi = RestService.For<IGitHubApi>("https://api.github.com",
502503
new RefitSettings {

0 commit comments

Comments
 (0)