Making PUT and GET Responses

Try to use getResponseText() on your response instead of getBodyContent(). Or doublecheck that you are getting correct JSON string from a response.

both .getResponseText() and .getResponseBodyContent() prints same text. Output looks as below:

You need pure JSON, remove status code from the String variable with response.

Removed that, same output

And what is the content of bodyContent variable? What error you get?

ResponseObject get_body = WS.sendRequestAndVerify(rog)

String bodyContent = get_body.getResponseBodyContent()

int statusCode = get_body.getStatusCode()

System.out.println(bodyContent)

Just want to print that bodyContent not on the one line, but to have a pretty view. Like that:
image

Anyway, everything works well, thats not a big problem.

That’s weird, it looks like a valid JSON string. And what do you see in a console when you run
println new JsonObject(bodyContent).toString(4) ? I mean in a console of a test case.

image

Can you see it now? :slight_smile:

If I will use jString variable, I should write Json myself yes ?

You try to create an instance of JsonObject class, but the class name is JSONObject. :stuck_out_tongue_winking_eye:

1 Like

Many thanks to you Marek !