JSON is not a regular language
<https://cstheory.stackexchange.com/a/4017> therefore it's not
recommended to use Regular Expression Extractor for extracting data from
JSON responses.
Consider using JSON JMESPath Extractor
<https://jmeter.apache.org/usermanual/component_reference.html#JSON_JMESPath_Extractor>
instead, the relevant configuration would be something like:
* Names of created variables: anything meaningful, i.e. *token*
* JMESPath Expressions: *access_token*
* Match No.: *1*
The extracted value can be referenced as *${token}* where required.
More information:
1. JMESPath Tutorial <https://jmespath.org/tutorial.html#jmespath-tutorial>
2. The JMeter JSON JMESPath Extractor and Assertion: A Guide
<https://www.blazemeter.com/blog/the-jmeter-json-jmespath-extractor-andassertion-a-guide>
On 5/18/2022 2:12 PM, Anil Gaur wrote:
Hello Team,
I need to pass this token in another request. I tried regular expression but it
can't capture the token value. Can anyone please help here.
Token:-
{
"access_token":
"ya29.a0ARrdaM9yF-37u56HJHPMhJfofpGUADl-rfYAL1dOL5pJIA6kGvLks_KkRdrng6O1kQpkD2NmvxGCWtk_30YWNwl7qItKo10YhUYxmZGjyRJaZYL4XbY0X0-iNN5jSH7gOCKMquwu3ttJom7RkwA2xTkHPqy8KatdCX5ohpPB0VQAorEtbiJqgIEM-0Q9L7Q_IAOxEvBb6g7xDMmWMbsxSm9eeFpKqKEkwtafu5MXGguLX3SRMLiRll1Of0U3HDPrm-A",
"expires_in": 3599,
"scope":"https://www.google.com/accounts/OAuthLogin",
"token_type": "Bearer"
}
Regards
Anil Gaur