From 53b52a05ff379f758c78ed86b88719a06d7d908e Mon Sep 17 00:00:00 2001 From: Digifais Date: Wed, 28 Aug 2024 13:02:02 +0200 Subject: [PATCH] Update README.md JSON Source Generator JsonSerializerOptions.AddContext is obsolete. (https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions.addcontext?view=net-8.0) --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d384f2c33..d96ae1e5f 100644 --- a/README.md +++ b/README.md @@ -495,8 +495,9 @@ public class Foo 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`: ```csharp -var options = new JsonSerializerOptions(); -options.AddContext(); +var options = new JsonSerializerOptions() { + TypeInfoResolver = MyJsonSerializerContext.Default +}; var gitHubApi = RestService.For("https://api.github.com", new RefitSettings {