Forum Discussion
Hi, sure, I'm using SoapUI 5.1.2 and have a REST GET request (REQUEST1) that returns JSON which I have validated using jsonlint.com. In a testsuite I create a new testcase with 2 test requests and a Property Transfer. In the property transfer I set the source and target to the two testcase requests. In the source, I set the property to 'Response' and the path language to 'JSONPath'. In the target I set the property to Request and the path language to JSONPath. Now, Im using http://goessner.net/articles/JsonPath/ for the syntax for JSONPath and have $.* in my source expression, which I think should be everthing in the response. Now, when I run the property transfer I get "[Invalid JSON: { .... " in the transferred values. Now, I'm assuming I have the syntax in the source expression wrong but I'm not sure.
Interestingly, and I'm not sure if this is important or not, the JSON shown in the JSON tab is 'not the same' as in the Raw tab (the "class" object is missing)...
Hi, just to follow up on my previous post and state what I'm are trying to achieve; I have a REST web service method that returns a JSON response. I would like to extact a value from the body of the repsonse and pass it to another REST web service method that takes the value in the URL. How would I do this in SoapUI 5.1.2?
Simplified Example (not related to the screen shots in the previous post)
------------------------
First web service method;
GET /customers
{"customers": [
{
"firstName": "John",
"lastName": "Smith",
"customerId": "12345"
}
]}
>> extract customerId from JSON response, then >>>>
second web service method with customerId
GET /customer/12345
- Dima10 years agoNew Contributor
to extract customerID try $.customers[0].customerId
this tool may help - http://ashphy.com/JSONPathOnlineEvaluator/
Related Content
Recent Discussions
- 20 hours agoruchisingh