I
I
Ilya2021-06-17 14:24:44
Java
Ilya, 2021-06-17 14:24:44

How to get the value of a specific parameter in an api request response (Java Selenium)?

Hello.
There is such a line in the method of sending a POST request to a specific url.
60cb3087e15e2410333801.png

In the response, I receive all the response parameters with their values.
It is necessary for me that I receive from all these parameters only the value of a certain parameter, let's say the value of the "secret" parameter.

How it is better to implement it? Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-06-17
@ilyaQA

Good afternoon.
I will assume that you receive JSON in the response. Accordingly, you need either to work with json. For example, gson or jackson. Create a pojo with the desired structure, read the response in JSON (deserialization). Get the value of secret.
Another solution, if you don't need a lib, write a DOM Parser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question