Asad
Asad

Reputation: 73

How to Extract a specific value from this JSON response in Jmeter?

{"SecureCustomerLoginFPinResult":"{\"Success\":true,\"AccountCode\":\"AC0717000251\",\"AccountId\":\"251\",\"FullName\":\"Asad\",\"LastLoginTime\":\"Jan 18, 2018, 12:16:19 PM\",\"IsFirstLogin\":\"0\",\"WalletAmount\":93982.40,\"SessionId\":\"efa02b314f\",\"ProfileImage\":\"\",\"NickName\":\"\",\"UnreadRequest\":\"1\",\"ProfileLevel\":\"0\",\"IsPinSet\":\"1\",\"LastName\":\"Akram\",\"CashDepositMinAmount\":\"100.00\",\"InviteCode\":\"https:\/\/test.keenu.pk\/keenu\/?Asad7207\",\"InvitePoints\":50,\"SignUpPoints\":40,\"KeenuCode\":\"trfhf\",\"DebitCreditFeeChargeInPercentage\":\"10.00\",\"CustomerState\":\"C\",\"BankCategoryId\":\"1\",\"IsNameVerifed\":\"False\",\"CustomerPoolBalances\":[{\"Amount\":\"83305.00\",\"CustomerPoolId\":\"499\",\"PoolId\":\"1\",\"Priority\":\"1\",\"ExpirationDate\":\"18\/01\/19\",\"AmountToBeExpire\":\"\"},{\"Amount\":\"10677.40\",\"CustomerPoolId\":\"500\",\"PoolId\":\"2\",\"Priority\":\"2\",\"ExpirationDate\":\"31\/01\/18\",\"AmountToBeExpire\":\"200.00\"}]}"}

I have want to extract 'SessionId' from this JSON response using JSON Extractor in Jmeter. I have tried multiple path expressions but with no success. Please help. Thanks.

Upvotes: 1

Views: 2321

Answers (1)

ararar
ararar

Reputation: 983

You can extract the SessionId value using Regular expression extractor with the below configurations:

  • Reference Name: MyVar //The name of the variable which will hold the extracted value.
  • Regular expression: \\"SessionId\\":\\"(.*?)\\"
  • Template: $1$
  • Match No: 1
  • Default value: NOT_FOUND

Reference:

Using-RegEx-Regular-Expression-Extractor-with-JMeter

Upvotes: 1

Related Questions