40. Convert JSON Array API Response to Java List to extract values in Rest Assured

preview_player
Показать описание
Hey Guys,
We need to perform assertions of values in API Response. To assert that a specific value from the response body we need to extract them. There are multiple ways to do so. We have already learned to convert a simple JSON object to a Java Map and extracted value for any field easily.

In this video, we will convert or deserialize the JSON Array response to Java List.

If you do not like my content please share your feedback so that I can improve myself.

If you like my content then please like, subscribe, and share.

Thanks
Amod
Рекомендации по теме
Комментарии
Автор

Hello Sir

Your explanation for Rest assured is awesome.
Please cover auth 0.1, 0.2

ravikakkereni
Автор

Instead of sysout we can print the response using log().all() method and we can use matchers methods to validate the response. Can you pls show the video related to that and by using Jackson data binder as well for serialization and deserialization

ktnuhvz
Автор

sir
thanks a lot or the video..i am beginner in Restassured .Can you kindly tell me why we are converting json response object to map and json response array to list.kindly reply.can we use JSONArray and JSONObject instaed of this

dhanyacm
Автор

Hello Sir, I am getting the below error while using list to store the array response .
java.lang.Exception: Cannot parse content to interface java.util.List because no content-type was present in the response and no default parser has been set.

You can specify a default parser using e.g.:

RestAssured.defaultParser = Parser.JSON;

Kindly Help

manikandankm
Автор

Hi, I have stored the JSON response in a file directory I want to convert that response into JSONOBJECT and extract keys alone, Here you have explained with restassured and URL, can you please explain that as well because I am not able to use typeref and other ways I tried I am getting unchecked conversion error

gurulakshmigurumadhu
Автор

I want to fetch amount which is inside another json nested Jason .... [{ "intialAmount" : { amount : 1.0, "currency" : "USD" }}].... How to write code for this? or response.get(amount)? In both the cases I'm getting null can you please help? Thanks in advance... I want to validate amount from the response with amount I'm passing while creating the transaction.. So passed amount should be stored properly.

praveenbennur
Автор

How can we do that without restassured

ankitasharma
welcome to shbcf.ru