-
Notifications
You must be signed in to change notification settings - Fork 5
JSON support
skwasjer edited this page Dec 24, 2021
·
2 revisions
The default serializer used to serialize to and from JSON is System.Text.Json
.
The serializer is used with the .JsonContent(..)
match extension as well as the .RespondJson(..)
response extension.
To change the serializer to Newtonsoft for all expectations and verifications on the mock:
var mockHttp = new MockHttpHandler();
mockHttp.UseNewtonsoftJson();
To change the serializer to Newtonsoft for a specific request or response only, pass in the JsonSerializerSettings
when setting up the request or response.
The default serializer has changed since v3.x from Newtonsoft to
System.Text.Json
.