Forum Discussion
- HKosovaSmartBear Alumni (Retired)
Hi saftron,
Your question sounds like it's about SoapUI or Ready! API, but this forum is for SwaggerHub. Could you please clarify which product are you using? Thanks!
- PaulMSSuper Contributor
Select the source test step and source property = response.
You can select the path language JSONPath, but in this case the Xpath/JSONPath selection field should be blank otherwise the the property transfer will fail with Invalid JSON error.
The response can be transferred without using JSONPath selection but the value will include the quotation marks.
- saftronOccasional Contributor
Thank you for your response. But response which I send as json request which getting failed due to format. How to trim my json values ?
Actual Results: "LocalDateTime": "\"2017-05-17T15:20:51.1117456Z\"",
Expected Results: "LocalDateTime": "2017-05-17T15:20:51.1117456Z",
- HKosovaSmartBear Alumni (Retired)
In this case Property Transfer transfers the entire response contents, including the quotes around the value. To transfer the unquoted value, you need to use a Groovy script instead.
For example, you can extract the value to a test case property named timestamp:
// Replace "Test Step 1" with your test step name
def value = testRunner.testCase.testSteps["Test Step 1"].testRequest.response.responseContent // remove the enclosing quotes value = value.replaceAll('^"|"$', '') testRunner.testCase.setPropertyValue("timestamp", value)and in the second request, use
${#TestCase#timestamp}
- nmraoChampion Level 3Response does not seem to appear as json but header says it's json. Please check with your application / service provider or contact with your team if it is internal.
- HKosovaSmartBear Alumni (Retired)
nmrao wrote:
Response does not seem to appear as json but header says it's json. Please check with your application / service provider or contact with your team if it is internal.Whether or not a simple "string" is valid JSON depends on the standard used. It's not valid JSON according to RFC-4627, but is valid JSON according to the newer RFC-7159.
There's more info here:
http://stackoverflow.com/questions/18419428/what-is-the-minimum-valid-json/22361229#22361229
Related Content
- 5 years ago
- 2 years ago
- 9 years ago
Recent Discussions
- 3 hours ago
- 20 hours ago
- 3 days ago
- 3 days ago