cancel
Showing results for 
Search instead for 
Did you mean: 

How do i get all the elements (with out the values) of a json response in soapui using groovy.

garlapati99
Occasional Contributor

How do i get all the elements (with out the values) of a json response in soapui using groovy.

Here is my requirement.

 

I need only the elements of a json response. I dont want its values. I want to achieve this in free version of soapui using groovy. Any advice.

 

Thanks

4 REPLIES 4
nmrao
Community Hero

Re: How do i get all the elements (with out the values) of a json response in soapui using groovy.

can you show the response?


Regards,
Rao.
garlapati99
Occasional Contributor

Re: How do i get all the elements (with out the values) of a json response in soapui using groovy.

Hi Rao,

 

Here is my JSON Response

 

{
"base": "SGD",
"date": "2017-01-20",
"rates": {
"AUD": 0.92874,
"BGN": 1.2869,
"BRL": 2.2356,
"CAD": 0.93545,
"CHF": 0.70582,
"CNY": 4.8115,
"CZK": 17.779,
"DKK": 4.8927,
"GBP": 0.56978,
"HKD": 5.4275,
"HRK": 4.9457,
"HUF": 203.38,
"IDR": 9381.5,
"ILS": 2.6648,
"INR": 47.692,
"JPY": 80.583,
"KRW": 822.94,
"MXN": 15.377,
"MYR": 3.1113,
"NOK": 5.9212,
"NZD": 0.9798,
"PHP": 35.015,
"PLN": 2.8753,
"RON": 2.957,
"RUB": 41.853,
"SEK": 6.2556,
"THB": 24.793,
"TRY": 2.6757,
"USD": 0.69957,
"ZAR": 9.5309,
"EUR": 0.65798
}
}

 

Thanks,

Kalyan

nmrao
Community Hero

Re: How do i get all the elements (with out the values) of a json response in soapui using groovy.

So do you want the keys of "rates"? what is your use case? What do you do after finding the keys?


Regards,
Rao.
garlapati99
Occasional Contributor

Re: How do i get all the elements (with out the values) of a json response in soapui using groovy.

Hi Rao,

 

Yes i want only the keys, the response is a sample one but i want to achieve is that we need to compare the keys before and after the build.

 

I am trying to capture the keys and copy it to an excel and then after the build do the same and compare.

 

Thanks,

Kalyan

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