Json Assertions

154 views
Skip to first unread message

Rolando Sanchez

unread,
May 14, 2021, 8:14:15 PM5/14/21
to jmeter-plugins
Hey trying to get values from the json here but not able to dig deep on the second section ( inside Results ) any idea

This is the json i received as response
{
    "ResultCode": 0,
    "Result": "{\"RiskScore\":2,\"DOB\":\"Jun 1968\",\"Age\":\"52\",\"Gender\":\"U\",\"Deceased\":\"N\",\"PersonsInHousehold\":\"2 persons\",\"ChildrenInHousehold\":\"0 children\",\"AddressType\":\"Street\",\"AddressUse\":\"Residential\",\"PropertyType\":\"Residential\",\"Vacant\":\"No\",\"Ownership\":\"Homeowner\",\"LengthOfResidence\":\"36\",\"hasCIResults\":true,\"hasDirResults\":true,\"EnlPhoneToName\":2,\"EnlEmailToName\":1,\"EnlAddressToName\":2,\"EnlAddressToPhone\":2,\"EnlEmailToAddress\":1,\"EnlEmailToPhone\":1,\"LinkageSummary\":{\"Summary\":\"Verified\"},\"hasAddressTwoResponse\":false,\"hasAddressTwoRequest\":false}"
}

Want to run assertion on RiskScore value for example

Any ideas welcome, tried with json assertion and response assertion and jp@gc - JSON/YAML Path Assertion and no luck

DT

unread,
May 17, 2021, 3:07:45 AM5/17/21
to jmeter-plugins
This Result attribute value is a JSON hidden in another JSON so I would recommend taking the following approach:

  1. Use JSON JMESPath Extractor to get Result attribute value out of the response
  2. Use Another JSON JMESPath Extractor to get RiskScore value out of the Result variable
  3. Use Response Assertion to compare the RiskScore with the anticipated value

Example setup and demo:

headers.gif

Sangeetha s

unread,
May 17, 2021, 3:23:29 AM5/17/21
to jmeter-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages