Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response BodyAsJson with array does not work #721

Closed
MarwaAloui opened this issue Feb 8, 2022 · 4 comments
Closed

Response BodyAsJson with array does not work #721

MarwaAloui opened this issue Feb 8, 2022 · 4 comments
Labels

Comments

@MarwaAloui
Copy link

MarwaAloui commented Feb 8, 2022

Hello, i want to configure the response of WirMock as BodyAsJson and inside i have an array of object

"Response": {
      "StatusCode": 200,
      "BodyAsJson": [
      {
          "ModelType": "XXX",
          "ModelNumber": "1"
      }
      ]
},

when i execute i have an error :
{ "Status": "Object serialized to Array. JObject instance expected." }

is it a bug?

@StefH
Copy link
Collaborator

StefH commented Feb 9, 2022

@MarwaAloui
I tried to reproduce your error:

"Response": {  
      "StatusCode": 200,  
      "Headers": {  
        "Content-Type": "application/json"  
      },  
      "BodyAsJson": [  
        {  
          "id": 100,  
          "name": "Sofie",  
          "hasOwner": true,  
          "birthDate": "2019-12-05T11:00:30.573+01:00",  
          "animal": {  
            "id": 1,  
            "name": "Cat"  
          }  
        }  
      ]  
    }

However this works fine?
image

@MarwaAloui
Copy link
Author

Thank you for your quick response
i retried without "UseTransformer": true, and it works well.

@StefH
Copy link
Collaborator

StefH commented Feb 9, 2022

I see.

I'll check the code.

@StefH
Copy link
Collaborator

StefH commented Feb 9, 2022

It's fixed.

A new version will be released soon.

@StefH StefH closed this as completed Feb 9, 2022
@StefH StefH added bug and removed question labels Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants