Contributions
Re: Boolean check
def jsonString = '''{ "Content" : { "2024-02-26" : { "2222" : [ { "Field1" : 101985, "Field2" : "TYRE", "Field3" : "2024-02-26T08:30:00", "Field4" : "08:30", "Field5" : "26 Feb 2024", "Field6" : 1, "Field7" : 60, "Field8" : 6380, "Field9" : 127, "Field10" : "Past", "Field11" : false, "Field12" : 0, "Field13" : null, "Field14" : 2961655, "Field15" : null, "Field16" : null, "Field17" : null } ] } } }''' def json = new groovy.json.JsonSlurper().parseText(jsonString) assert json.Content.'2024-02-26'.'2222'[0].Field1 == 101985 I swear that this is my last question on this, also i apologise for my stupidity. What i need to do is compare the value of Field 1 to what is in Datasourcebook1, then if both are the same then return true, but if DatasourceBook1 is different return false. it may be that i have to put 101985 into a variable then compare the 2 variables. what i have. def json = new groovy.json.JsonSlurper().parseText(jsonString) assert json.Content.'2024-02-27'.'6380'[0].BranchCode == 101985 check = false; if (json.contains == (datasourceBook1) ) { check = true; }; log.info "check=$check";2 months agoPlace ReadyAPI QuestionsReadyAPI Questions0Views0likes2Comments- 2 months agoPlace ReadyAPI QuestionsReadyAPI Questions35Views0likes1Comment
Re: Boolean check
Json I need to access Field 1 { "Content" : { "2024-02-26" : { "2222" : [ { "Field1" : 101985, "Field2" : "TYRE", "Field3" : "2024-02-26T08:30:00", "Field4" : "08:30", "Field5" : "26 Feb 2024", "Field6" : 1, "Field7" : 60, "Field8" : 6380, "Field9" : 127, "Field10" : "Past", "Field11" : false, "Field12" : 0, "Field13" : null, "Field14" : 2961655, "Field15" : null, "Field16" : null, "Field17" : null } ] } } }2 months agoPlace ReadyAPI QuestionsReadyAPI Questions21Views0likes0CommentsBoolean check
Hi All I'm almost there, i need to check that a json response contains 1234 within an array, and return true. and if it doesn't return false. boolean check = "FAIL" if (response.contains("1234") ) { check = "PASS"; }2 months agoPlace ReadyAPI QuestionsReadyAPI Questions61Views0likes13Comments- 2 months agoPlace ReadyAPI QuestionsReadyAPI Questions4Views0likes0Comments
- 2 months agoPlace ReadyAPI QuestionsReadyAPI Questions12Views0likes1Comment