Home > Blockchain >  Deserialise API Response of PlayWright using Java
Deserialise API Response of PlayWright using Java

Time:06-07

I am exploring playwright for automating api tests and I am unable to deserialise APIResponse of playwright to a POJO using java. I used to do this with rest assured using following code:

        PetStoreModel petStoreModel =  response.as(PetStoreModel.class);

CodePudding user response:

I managed to do this with the help of ObjectMapper.

APIResponse response = getPetStoreResponse();
ObjectMapper objectMapper = new ObjectMapper();
PetStoreModel petStoreModel = objectMapper.readValue(response.text(),PetModel.class);
  • Related