Skip to content

Commit 1679f5f

Browse files
committed
Update system-text-json.md
1 parent 8273cc5 commit 1679f5f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

MyApp/_pages/system-text-json.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ app.UseServiceStack(new AppHost(), options => {
1313
});
1414
```
1515

16+
### Configure System.Text.Json APIs
17+
18+
You can configure when to use System.Text.Json for APIs when registering to use Endpoint Routing:
19+
20+
```csharp
21+
app.UseServiceStack(new AppHost(), options => {
22+
// Use for Serialization and Deserialization of JSON APIs (default)
23+
options.MapEndpoints(useSystemJson:UseSystemJson.Always);
24+
25+
// Use only for deserializing API Requests
26+
options.MapEndpoints(useSystemJson:UseSystemJson.Request);
27+
28+
// Use only for serializing API Responses
29+
options.MapEndpoints(useSystemJson:UseSystemJson.Response);
30+
31+
// Don't use System.Text.Json for APIs
32+
options.MapEndpoints(useSystemJson:UseSystemJson.Never);
33+
});
34+
```
35+
1636
### Enhanced System.Text.Json
1737

1838
To improve compatibility with existing ServiceStack DTOs using ServiceStack.Text [JSON Serializer](/json-format) and

0 commit comments

Comments
 (0)