getElementPropertyValue is returning null even if there is a value

I am verifying values in a few fields in the response file. Ran into this issue where 2 of the fields are returning null even though they have values in them. I am pretty much cross eyed looking at the code to see if I made any mistakes, but I am not seeing anything. Looking for another set of eyes on this code. Or if anyone else ran into this issue, what was used to get past this issue? Or should I be using another verification method for this? But I wanted some help trying to figure this out. TIA.

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].plaidStatus’).toString().replace(‘null’,’’), ‘Linked’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].quizState’).toString().replace(‘null’, ‘’), ‘pass’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].result’).toString().replace(‘null’, ‘’), ‘PASS’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].agreementStatus’).toString().replace(‘null’, ‘’), ‘Application Complete’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].asdStatus’).toString().replace(‘null’, ‘’), ‘Agreed’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].agreementSigned’).toString().replace(‘null’, ‘’), ‘true’, false, FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyMatch(WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].fundingAmountStudent’).toString().replace(‘null’, ‘’), ‘5000.00’, false, FailureHandling.CONTINUE_ON_FAILURE)

The response file fields have the following values in these fields
agreementStatus:Application Complete

When I tried to print response it is showing null, but response file has a value
2021-03-03 11:20:07.113 DEBUG et Agreement Details Using StudentAuthID - 9: println(getElementPropertyValue(ResponseGetAgreementbyAuthID, “result[0].plaidStatus”))
2021-03-03 11:20:07.142 DEBUG et Agreement Details Using StudentAuthID - 10: println(getElementPropertyValue(ResponseGetAgreementbyAuthID, “result[0].result”))

Please show the Json text in the ResponseObject.

You can print it like the following

import groovy.json.JsonOutput

// somehow you obtain ResponseGetAgreementbyAuthID object

def jsonText = ResponseGetAgreementbyAuthID.getContentText()
println JsonOutput.prettyPrint(jsonText)

Thanks @kazurayam for the response.
I have the response, but it is very big. I copy pasted just parts of the response that I was using in verification in my post. But here is part of the response

I tried to use the code you gave, but I got an error to use .getContentType instead of getContentText. Then I am getting the below error…
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading ‘a’, no possible valid JSON value or punctuation could be recognized.
at Get Agreement Details Using Agreement Details Using StudentAuthID:129)

You did not disclose the response, so all I could do was to create a mimic of you test case assuming the fragment you mensioned is exactly equal to the response.

import groovy.json.JsonSlurper

//String contentText = ResponseGetAgreementbyAuthID.getContentText()
String contentText = """
	"result": [
			"plaidStatus": "Linked",
			"quizState": "pass",
			"result": "PASS",
def slurper = new JsonSlurper()
def obj = slurper.parseText(contentText)

def plaidStatus = obj.result[0].plaidStatus
assert plaidStatus == 'Linked'
println "plaidStatus is ${plaidStatus}"

def result = obj.result[0].result
assert result == 'PASS'
println "result is ${result}"

When I ran this, i got the following output in the console:

2021-03-04 12:39:48.062 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2021-03-04 12:39:48.067 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/TC8
2021-03-04 12:39:49.181 DEBUG testcase.TC8                             - 1: contentText = "
	"result": [
			"plaidStatus": "Linked",
			"quizState": "pass",
			"result": "PASS",
2021-03-04 12:39:49.188 DEBUG testcase.TC8                             - 2: slurper = new groovy.json.JsonSlurper()
2021-03-04 12:39:49.207 DEBUG testcase.TC8                             - 3: obj = slurper.parseText(contentText)
2021-03-04 12:39:49.232 DEBUG testcase.TC8                             - 4: plaidStatus = plaidStatus
2021-03-04 12:39:49.257 DEBUG testcase.TC8                             - 5: assert plaidStatus == "Linked"
2021-03-04 12:39:49.261 DEBUG testcase.TC8                             - 6: println(plaidStatus is $plaidStatus)
plaidStatus is Linked
2021-03-04 12:39:49.309 DEBUG testcase.TC8                             - 7: result = result
2021-03-04 12:39:49.311 DEBUG testcase.TC8                             - 8: assert result == "PASS"
2021-03-04 12:39:49.315 DEBUG testcase.TC8                             - 9: println(result is $result)
result is PASS
2021-03-04 12:39:49.331 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/TC8

The test case worked fine.

I could not reproduce your problem. I could not see why. Possibly, the actual content text is different from what you have in your mind.

Thanks so much again @kazurayam I looked at it again with a fresh sets of eyes this morning and figured out my mistake :woman_facepalming: Feel so silly, I had to go into one more layer to get that value. The response was so huge and I was looking at it as this huge text after parsing, I missed the indents for these 2 fields. I had to change the path to the fields and then I was able to get the field values.
println WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].student.plaidStatus’)
println WS.getElementPropertyValue(ResponseGetAgreementbyAuthID, ‘result[0].quizAttempt[0].result’)

Again I am posting only part of the response.
def jsonText = ResponseGetAgreementbyAuthID.getContentText()
println JsonOutput.prettyPrint(jsonText)

result:[[vemoContractNumber:1000023193, totalFullyAllocatedAmountDue:null, submittedDateTime:null, studentPrimarySchoolStudentId:AutoID_2233, studentName:John L Lynch II, studentID:0016C00000ViFJ2QAN,, student:[updatePlaidPassword:false, timeZone:null, suffix:II, studentID:0016C00000ViFJ2QAN,, street:1402 Comfort St, stateCode:MI, state:Michigan, ssnTaxID:*--6112, schoolProgramOfStudyID:null, schoolEntryPoint:testautomation, salutation:null, residency:US Citizen, primarySchoolStudentID:AutoID_2233, primarySchoolName:Test Automation School, primarySchoolID:0016C00000SrSLDQA3, primarySchoolGraduationDate:null, primarySchoolGradeLevel:null, primarySchoolEnrollmentStatus:null, primarySchoolEmail:null, preferredName:JohnLynch2233, preferredMethodOfCommunication:null, postalCode:48915,, portalPreferences:null, plaidStatus:Linked, otherStreet:456 Main St, otherStateCode:AL, otherState:Alabama, otherPostalCode:24455, otherCountry:United States, otherCity:Hell, mobilePhone:+1 (878) 656-5443, middleName:L, lastName:Lynch, isBouncedEmail:false, homePhone:5435768787, firstName:John,, dueDayOfTheMonth:1, driversLicenseOrStateID:null, doNotText:false, doNotEmail:false, doNotCall:false, cumulativeIncomeShareCap:20.0000, cumulativeIncomeShare:10.0000, credit:null, country:United States, commonLineID:null, city:Lansing, birthdate:1994-09-01, autoPaymentFrequency:null, autoPaymentDayOfMonth2:null, autoPaymentDayOfMonth1:null, autoPaymentDateActivated:null, autoPayment:false, authSystemUserID:auth0|603fad8ccf80a40069a8ad8a, alternateServicingPhoneNumber:null,,, accountNumber:10026120], stateOfResidenceStudent:AL, stateOfResidencePreCertification:null, stateOfResidencePostCertification:AL, stateOfResidenceCertification:null, signingURL:*, signedAgreementURL:, signedAgreementID:00P6C000007gIr7UAE, servicingStartDate:null, servicing:false, schoolStudentID:null, schoolProgramOfStudyID:null, schoolID:0016C00000SrSLDQA3, rightToCancelDate:2021-03-09, residencyStudent:US Citizen, residencyPreCertification:null, residencyPostCertification:US Citizen, residencyCertification:null, residency:null, requestedAmount:null, remainingTerm:16, registrationExceptionProcess:null, quizState:pass, quizResponseLink:null, quizLocked:false, quizAttempts:null, quizAttempt:[[submitTime:2021-03-03T15:40:24.964Z, startTime:2021-03-03T15:40:14.474Z, resultLink:, result:PASS, quizResponses:[[quizAttemptID:a1Z6C000000eKiZUAU, questionText:What is an ISA?, questionID:question1, fFQuizResponseID:a1a6C000000TzaQQAS, correctAnswer:true, answerText:A contract between you and your school, answerID:item2], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:How is your monthly payment amount calculated?, questionID:question2, fFQuizResponseID:a1a6C000000TzaRQAS, correctAnswer:true, answerText:Gross Monthly Earned Income multiplied by the Income Share Percentage, answerID:item3], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:Who determines the maximum amount of ISA funding you are eligible to receive?, questionID:question3, fFQuizResponseID:a1a6C000000TzaSQAS, correctAnswer:true, answerText:Your School, answerID:item3], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:When can you cancel your ISA contract without penalty?, questionID:question4, fFQuizResponseID:a1a6C000000TzaTQAS, correctAnswer:true, answerText:During the cancellation period only, answerID:item3], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:What is an income share?, questionID:question5, fFQuizResponseID:a1a6C000000TzaUQAS, correctAnswer:true, answerText:The percent of your gross monthly earned income that you will pay during your payment term, answerID:item1], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:Payments are due on your ISA when you earn less than the minimum income requirement., questionID:question6, fFQuizResponseID:a1a6C000000TzaVQAS, correctAnswer:true, answerText:False, answerID:item2], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:If you elect to pay off your ISA contract early, how much will you pay?, questionID:question7, fFQuizResponseID:a1a6C000000TzaWQAS, correctAnswer:true, answerText:The payment cap, answerID:item1], [quizAttemptID:a1Z6C000000eKiZUAU, questionText:You are required to provide income documentation to Vemo Education., questionID:question8, fFQuizResponseID:a1a6C000000TzaXQAS, correctAnswer:true, answerText:True, answerID:item1]], fFQuizAttemptID:a1Z6C000000eKiZUAU, contractID:a0p6C00000048uFQAQ, clientID:a0p6C00000048uFQAQ-at1, attemptOrder:1]], programNotes:null, programName:Program - PreCertify All Pages, programID:a0n6C000001P4QIQA0, program:[totalDefermentMonths:48, templates:[], stipendDisbursements:false, schoolStudentIDRequired:false, schoolProgramOfStudyRequired:true, schoolProgramOfStudyCollected:true, schoolID:0016C00000SrSLDQA3, schoolCampusServiceName:Mitch Finer, schoolCampusServiceMobile:813 724 3411 ext 116,, schoolCampusServiceAvailability:Monday - Friday 8am - 8pm ET, rightToCancelDays:3, residencyRequired:true, residencyCollected:true, registrationEndDate:2022-12-31, registrationBeginDate:2020-07-01, quizResultID:fd05d315-e482-49d3-bb1e-843b0184238a, quizPostID:e0ec9d90-154c-4080-bf4e-db8d93e0d3b5, quizLinkURL:null, quizLinkID:bcce39fd-83a9-4bfb-9c99-b483cb6f900a, quizAttemptsBeforeLock:2, programStatus:Open, programNotes:null, programName:Program - PreCertify All Pages, programID:a0n6C000001P4QIQA0, minimumIncomePerMonth:3333.34, instructionText:

To be eligible for funding, you must:

So sorry to have wasted your time, but cannot thank you enough for taking the time to look at this and actually trying to recreate the issue I was having. And you were so right about wanting to see the response, you would have caught it immediately.

Another question on this - I tried the code you initially suggested hoping that it would print out the response in a more readable way. But I got errors using it. any idea on what I am doing wrong?
import groovy.json.JsonOutput

I have no idea. I do not see whole of your code, so it is impossible to debug it for you.

result:[[vemoContractNumber:1000023193, totalFullyAllocatedAmountDue:null, submittedDateTime:null, studentPrimarySchoolStudentId:AutoID_2233, studentName:John L Lynch II, …

This output is not a well-formed JSON text. Do you know what JSON is? Do you distinguish a JSON text and a non JSON text? I doubt it.

Now you should step back, take a breath, and study programming for JSON processing with some good text. Read the following article, type sample codes and run in Katalon Test Cases.

@kazurayam The output response that I posted is not JSON text. It is parsed text of the response I got. Thanks for your help, but I did figure out my mistake on the initial issue I posted. I will mark this post solved.
Thanks for your suggestion and I will definitely look up the article you sent.