cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to compare two JSON responses

SOLVED
Highlighted
Occasional Contributor

Best way to compare two JSON responses

 

Hi Team,

 

I would like to compare the actual JSON response with an expected JSON response by ignoring certain nodes and properties..Could you please let me know what is the best approach to do using readyapi?

 

I found a way to do the same for XML files looking for the support on JSON as well.

 

https://github.com/nmrao/groovyScripts/blob/master/compare/CompareWithIgnoreElements.groovy

Much appreciated..

 

Thanks

Andy

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: Best way to compare two JSON responses

Rao, Richie, thank you!

 

Hi @venkireddy1991 , I found a couple of threads you might want to check out:

 

https://community.smartbear.com/t5/SoapUI-Pro/compare-a-response-with-a-json-file/m-p/168926

https://community.smartbear.com/t5/SoapUI-Pro/Compare-2-JSON-responses-in-soapUIPRO-Groovy/m-p/16996...

 

 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: Best way to compare two JSON responses

Required to write code as needed for the data.


Regards,
Rao.
Highlighted
Community Hero

Re: Best way to compare two JSON responses

Hi @venkireddy1991,

If you search the readyapi and soapui open source forums for "compare json" you should get the .json equivalent of what you need. I remember there have been a couple of separate posts about comparing json in the last 3 months or so

Cheers

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Community Manager

Re: Best way to compare two JSON responses

Rao, Richie, thank you!

 

Hi @venkireddy1991 , I found a couple of threads you might want to check out:

 

https://community.smartbear.com/t5/SoapUI-Pro/compare-a-response-with-a-json-file/m-p/168926

https://community.smartbear.com/t5/SoapUI-Pro/Compare-2-JSON-responses-in-soapUIPRO-Groovy/m-p/16996...

 

 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

Highlighted
Community Hero

Re: Best way to compare two JSON responses

You can check below library, there are some samples available too.
https://github.com/lukas-krecan/JsonUnit



Regards,
Rao.
Highlighted
Community Manager

Re: Best way to compare two JSON responses

Thank you Community for help🙂

 

@venkireddy1991 did the links provided help you? Please mark the best reply as a Solution🙂


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors