WithTransformer breaks when the response BodyAsJson is a List #699

Closed
opened 2025-12-29 08:32:40 +01:00 by adam · 1 comment
Owner

Originally created by @DanSantimore on GitHub (Jun 10, 2025).

Originally assigned to: @StefH on GitHub.

Hi there -- sorry for not following the exact template, but this is the same as:

https://github.com/wiremock/WireMock.Net/issues/721#issue-1127651313

this.Response = WireMock.ResponseBuilders.Response.Create()
                                                                  .WithStatusCode(HttpStatusCode.OK)
                                                                  .WithBodyAsJson(
                                                                      new List<Object>
                                                                      {
                                                                          new Object()
                                                                          {
                                                                          },
                                                                      }).WithTransformer();

Version 1.8.9

Error is: {"Status":"Object serialized to Array. JObject instance expected."}

Originally created by @DanSantimore on GitHub (Jun 10, 2025). Originally assigned to: @StefH on GitHub. Hi there -- sorry for not following the exact template, but this is the same as: https://github.com/wiremock/WireMock.Net/issues/721#issue-1127651313 ``` c# this.Response = WireMock.ResponseBuilders.Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBodyAsJson( new List<Object> { new Object() { }, }).WithTransformer(); ``` Version 1.8.9 Error is: `{"Status":"Object serialized to Array. JObject instance expected."}`
adam added the bug label 2025-12-29 08:32:40 +01:00
adam closed this issue 2025-12-29 08:32:41 +01:00
Author
Owner

@StefH commented on GitHub (Jun 11, 2025):

https://github.com/wiremock/WireMock.Net/pull/1315

@StefH commented on GitHub (Jun 11, 2025): https://github.com/wiremock/WireMock.Net/pull/1315
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#699