ContributionsMost RecentMost LikesSolutionsRe: how to verify json response with Database SQL Server nmrao , I want to show each uncommon values but with their keys . I have tried this , if(json != jdbc) { def plus = json + jdbc def intersect = json.intersect(jdbc) log.info plus - intersect } but in this way I can't get key , so this code is not beneficial to me at all :( In above thread case ids are different , I want to show like this. "CaseID 1 of json is not equal to CASEID 4 of jdbc" Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string Difficult to manage class , so I just break whole complex thing in sections, loop node and compare , Unit section is remaining in which I have profile , I don't know why it is returning null. log.info jsonResponseSlurper.Unit.Profile Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string nmrao, I have multiple values under Unit as provided Profile and UnitID, I got your point able to fetch all values of Unit.devices but unable to fetch values which are directly child of Unit like Profile and UnitID. I have so many values under Unit so yes I want to loop them as well. Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string This is just an example , my original json response has 304 values :smileyvery-happy: I want to assert all the elements of response Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string I just wanted to add all my json response values in array so that I can compare json array with my jdbc array. How can I do this nmrao, or is there any other way? Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string This is actual JSON string response, and after removing all extra delemeters, I got this JSON def JSONResponse = ''' { "Unit": { "Profile ": 12, "Devices ": [{ "Id ": 1, "DetailJSON": { "Name": "ALPR_1", "Profile": { "ID": 1, "BitRate": 0 }, "Index": -1 }, "PIPDetailJSON": { "Name": "ALPR_2", "Profile": { "ID": 2, "BitRate": 0, "Mode": "pip" } } }] }, "UnitID ": 12 } ''' Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string I have to add separate array for CDATA string , here is the code I'm able to get all JDBC values. import com.eviware.soapui.support.XmlHolder import groovy.json.* import groovy.xml.* def response = ''' <Results> <ResultSet fetchSize="128"> <Row rowNumber="1"> <CONFIGURATIONDETAILXML> <![CDATA[ <ROOT> <Profile>12</Profile> <BitRate>3072</BitRate> <VideoDevice> <Id>1</Id> <Devices>[{"Name":"ALPR_1","Profile":{"ID":1,"BitRate":0},"Index":-1}]</Devices> <PIPDevices> <Devices>[{"Name":"ALPR_2","Profile":{"ID":2,"BitRate":0},"Mode":"pip"}]</Devices> </PIPDevices> </VideoDevice> </ROOT> ]]> </CONFIGURATIONDETAILXML> <UNITID>Gita</UNITID> </Row> </ResultSet> </Results> ''' def holder = new XmlHolder(response) def configurationXmlCdata = holder.getNodeValue('//*:CONFIGURATIONDETAILXML') def XmlCdata = new XmlSlurper().parseText(configurationXmlCdata) def Cdatajdbc = [] XmlCdata.each { row -> Cdatajdbc.addAll(row.Profile,row.VideoDevice) log.info Cdatajdbc } def jdbcResponseSlurper = new XmlSlurper().parseText(response) def jdbc = [] jdbcResponseSlurper.ResultSet.Row.each { row -> jdbc.addAll(row.UNITID) log.info jdbc } But I'm getting error in case of JSON , //def JSONResponse = context.expand('${unitconfig#Response}') def JSONResponse = ''' "{\"Unit\":{\"Profile\":12,\"Devices\":[{\"Id\":1,\"DetailJSON\":\"[{\\\"Name\\\":\\\"ALPR_1\\\",\\\"Profile\\\":{\\\"ID\\\":1,\\\"BitRate\\\":0},\\\"Index\\\":-1}]\",\"PIPDetailJSON\":[\"[{\\\"Name\\\":\\\"ALPR_2\\\",\\\"Profile\\\":{\\\"ID\\\":2,\\\"BitRate\\\":0,\\\"Mode\\\":\\\"pip\\\"}]\"]}],\"UnitID\":12}" ''' def TrimResponse =JSONResponse.replaceAll('^\"|\"$','').replaceAll('\\\\','').replaceAll('\"\\[','')replaceAll('\\]\"','') def jsonResponseSlurper = new JsonSlurper().parseText(TrimResponse) log.info jsonResponseSlurper.Unit.Profile // 12 is displaying def json = [] jsonResponseSlurper.Unit.each { r -> json.addAll(r.Profile) // error displays log.info json } ERROR:groovy.lang.MissingPropertyException: No such property: Profile for class: java.util.HashMap$Entry Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string Great thanks let me try first :) btw can do same fashion with this JSON response ? Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string I don't know how to do this by loop Re: how to compare JSON response with JDBC request, when JDBC request contains CDATA string First compare and if any difference then print the difference, but I don't want to do this node by node .