Skip to content

Commit

Permalink
Update system-text-json.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 14, 2025
1 parent 8273cc5 commit 1679f5f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions MyApp/_pages/system-text-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ app.UseServiceStack(new AppHost(), options => {
});
```

### Configure System.Text.Json APIs

You can configure when to use System.Text.Json for APIs when registering to use Endpoint Routing:

```csharp
app.UseServiceStack(new AppHost(), options => {
// Use for Serialization and Deserialization of JSON APIs (default)
options.MapEndpoints(useSystemJson:UseSystemJson.Always);

// Use only for deserializing API Requests
options.MapEndpoints(useSystemJson:UseSystemJson.Request);

// Use only for serializing API Responses
options.MapEndpoints(useSystemJson:UseSystemJson.Response);

// Don't use System.Text.Json for APIs
options.MapEndpoints(useSystemJson:UseSystemJson.Never);
});
```

### Enhanced System.Text.Json

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

0 comments on commit 1679f5f

Please sign in to comment.