cancel
Showing results for 
Search instead for 
Did you mean: 

UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

SOLVED
Occasional Contributor

UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

I have a json response like below

 

  • {"payload": [{
    "maprefnum": "58",
    "stgtablename": "table_name",
    "tablename": "table_name_2",
    "sourcepriority": ""
    }]}

So how to give the regex expression for the above response. Whatever I give I get a 
Unknown character proeprty/ Some repetition error

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

@Jibu ,

Not sure what regex do you like to apply.

 

For instance, checking if all property values contains digits only for the given property.

Also, taking array to see with both passing and failing values.

Selection_025.png

 

 

Here is the script (text) with complete comments.

https://github.com/nmrao/soapUIGroovyScripts/tree/master/groovy/ValidateJsonPropertyWithRegex.groovy



Regards,
Rao.
4 REPLIES 4
Community Hero

Re: UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

It would help if you can specify what data do you need to verify?


Regards,
Rao.
Occasional Contributor

Re: UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

I want to validate
"maprefnum": "58",
Using contains assertion/any assertion using regex.
Community Hero

Re: UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

@Jibu ,

Not sure what regex do you like to apply.

 

For instance, checking if all property values contains digits only for the given property.

Also, taking array to see with both passing and failing values.

Selection_025.png

 

 

Here is the script (text) with complete comments.

https://github.com/nmrao/soapUIGroovyScripts/tree/master/groovy/ValidateJsonPropertyWithRegex.groovy



Regards,
Rao.
Occasional Contributor

Re: UNABLE TO CREATE REGEX EXPRESSION IN ASSERTION FOR REST JSON RESPONSE

Thank you so much sir.
February News
Top Kudoed Authors