cancel
Showing results for 
Search instead for 
Did you mean: 

how to extract text from Json Node

SOLVED
Highlighted
New Contributor

how to extract text from Json Node

Hello,

 

Can anyone help me in extracting text value from URL.

I have a Json node response in the following format:

JSON node =url

Value=http://aaa-test-bbb.websites.net/sample/c6e7b442-a33c-4bd3-bbbb-ef2d5873b661/l/TSKR4AM/details

I need to extract and pass the text highlighted in bold can be through property transfer or groovy script.

 

Appreciate quick response.

Thank you.

Brij

 

1 ACCEPTED SOLUTION

Accepted Solutions
Staff

Re: how to extract text from Json Node

Hi,

 

It is not possible out of the box since we can get the URL with point and click but to extract a resource path value you need groovy,

https://www.soapui.org/getting-started/point-and-click-testing/point-and-click-with-xpath.html

 

You can add a groovy script test Step for example if,

def str ="http://aaa-test-bbb.websites.net/sample/c6e7b442-a33c-4bd3-bbbb-ef2d5873b661/l/TSKR4AM/details"

def vals = str.split("/")

def token = vals[6].toString()

testRunner.testCase.setPropertyValue("token",token)

 

You can then add this expansion to substitute the value,${#TestCase#token}

 

Thanks

 

 

 

 

 

 



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

2 REPLIES 2
Staff

Re: how to extract text from Json Node

Hi,

 

It is not possible out of the box since we can get the URL with point and click but to extract a resource path value you need groovy,

https://www.soapui.org/getting-started/point-and-click-testing/point-and-click-with-xpath.html

 

You can add a groovy script test Step for example if,

def str ="http://aaa-test-bbb.websites.net/sample/c6e7b442-a33c-4bd3-bbbb-ef2d5873b661/l/TSKR4AM/details"

def vals = str.split("/")

def token = vals[6].toString()

testRunner.testCase.setPropertyValue("token",token)

 

You can then add this expansion to substitute the value,${#TestCase#token}

 

Thanks

 

 

 

 

 

 



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
New Contributor

Re: how to extract text from Json Node

Thanks a ton, it worked like charm.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors