Verify element property when json has a hyphen (-) in the identifier


#1

I have json elements like
"created-by": “abc”,
"updated-by": "xyz"

When I use
WS.verifyElementPropertyValue(response, ‘[0].updated-by’, ''xyz")
I get Verification FAILED
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify element property value (Root cause: Variable ‘by’ is not defined for test case.)

and when i use
WS.verifyElementPropertyValue(response, ‘[0][“updated-by”]’, ‘xyz’)
i get
Unable to verify element property value (Root cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: unexpected token: [ @ line 1, column 93.
** rseText(jsonText);return root.[0]["updat**

Can someone help me with this?
I know its better not to have hyphens in the elements all together, but for now what should be done when there is a hyphen in the element name?


Verify element property fails when there is a hyphen in json element name
#2

If it is as you say it is, that is a bug. Please report it here: https://forum.katalon.com/c/katalon-studio/katalon-studio-bug-reports

It’s perfectly fine and legal in JSON. You found a bug. Period.


#3

Thank you! Will report it.


#4