File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ type MyTestController() =
108108
109109To use FSharp.SystemTextJson in Giraffe (for example with the ` json ` function):
110110
111- * With Giraffe 5.x or newer, add the following to your ` configureServices ` function :
111+ * With Giraffe 7.x, ` FSharp.SystemTextJson ` is supported out of the box using the ` FSharpFriendlySerializer ` :
112112
113113 ``` fsharp
114114 open System.Text.Json
@@ -120,6 +120,23 @@ To use FSharp.SystemTextJson in Giraffe (for example with the `json` function):
120120
121121 let jsonOptions =
122122 JsonFSharpOptions.Default()
123+ // .Add customizations here...
124+ services.AddSingleton<Json.ISerializer>(Json.FsharpFriendlySerializer(jsonOptions)) |> ignore
125+ ```
126+
127+ * With Giraffe 5.x or 6.x, add the following to your `configureServices` function:
128+
129+ ```fsharp
130+ open System.Text.Json
131+ open System.Text.Json.Serialization
132+ open Giraffe
133+
134+ let configureServices (services: IServiceCollection) =
135+ services.AddGiraffe() |> ignore
136+
137+ let jsonOptions =
138+ JsonFSharpOptions.Default()
139+ // .Add customizations here...
123140 .ToJsonSerializerOptions()
124141 services.AddSingleton<Json.ISerializer>(SystemTextJson.Serializer(jsonOptions)) |> ignore
125142 // ...
You can’t perform that action at this time.
0 commit comments