Contributions
Re: split json
package json import com.eviware.soapui.support.XmlHolder import groovy.json.* def response = context.expand( '${Request#Response#$}' ) def r = new JsonSlurper().parseText (response) //I am trying to parse the following json response,I am expecting r to store the following //{"TTLRN":{"address":"tel:+919886977381","validity":"true","carrierid":"ABCD","carriername":"Myphone","type":"M","country":"India","portingstatus":"false","mcc":"eee","mnc":"000","mdetail":{"carrierid":"","carriername":"","rdate":""},"ddate":"","requestid":"test123","trackingid":"8002"}} log.info (r["TTLRN"]) //not able to understand what it should print.7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.9KViews0likes1CommentRe: split json
package json import com.eviware.soapui.support.XmlHolder import groovy.json.* // get the response of the JSON test step / request. // def response = context.expand( '${TestStepName s#Response}' ).toString() // below is a string representing the value provided in the forum post. //The above line can replace the below, with appropriate name of JSON response location def response = context.expand( '${NOS 2.3 Request#Response}' ).toString() def r = new JsonSlurper().parseText(response) log.info(r["TTLRN"]) getting the following response (java.lang.Object) {"TTLRN":{"address":"tel:+9999999999","validity":"yes","carrierid":"ABCDE","carriername":"Best Mobile","numbertype":"M","country":"Angola","deactivationdetail":{"carrierid":"","carriername":"","deactivationdate":""},"deactivationdate":"","requestid":"test123","trackingid":"101"}} r (java.lang.Object) There is no response for log.info(r["TTLRN"])7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.9KViews0likes1Commentsplit json
success_Response (java.lang.Object) {"TTLRN":{"address":"tel:+9999999999","validity":"Valued","carrierid":"0000","carriername":"MYDORA","numbertype":"L","country":"Uganda","portingstatus":"false","mcc":"641","mnc":"11","deactivationdetail":{"carrierid":"","carriername":"","deactivationdate":""},"deactivationdate":"","requestid":"nistesting9","trackingid":"101580039301503395442144"}} def success_Response = context.expand( '${TTLRN Request#Response#$}' ) def stringOutputSplitResponse=[] stringOutputSplitResponse[] = success_Response.split(/"/) def string = stringOutputSplitResponse[1] log.info string am unable to print TTLRN, expecting string to have assigned the value TTLRN2KViews0likes7Comments