Here is a raw response:
HTTP/1.1 200 OK
Date: Tue, 21 Oct 2014 08:46:31 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(9.2.2.v20140723)
{"id":"myId"}
I tried to set Property (source is response from another test step, property can be Request, Response etc.) Response and ResponseAsXML and for both I can not extract value. And try xPath selection but it does not work.
Is it possible to extract id
from HTTP response with json?
UPDATED
If I select ResponseAsXml I get the following string:
[<Response xmlns="http://localhost/path">
<id>882fe993-d150-b67c-4b0f-014931e2dd21</id>
</Response>]
I have tried xPath:
declare namespace sam="http://localhost/path";
//sam:response
Also I wrote //sam:Response
or //response
result is [null]
string.
Within REST Request, we get a response which is a JSON Object:
and when we want to transfer this response with Property Tranfer: we can leave Source text field empty and we will tranfer the whole JSON object, if we want to tranfer a data of this object which is in this case name we set the source text field $.name and we are now able to retrieve a specific data of the JSON object.