I want to extract a token from the the given below JSON response where the key of the token is dynamic. The key 57 is dynamic. it change every time. I know that how to extract value by given key but in my case the Key is dynamic. And based on the founded key I want to extract value.
On bottom of the question a complete JSON can be found, which is very shortened to better describe my problem.
{
"message": "Too many sessions, log out please, on one of your devices",
"active": {
"57": [
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjY5ODAiLCJlbWFpbCI6IkBAc3ViamVjdCsxQG9zYXQuY29tK29zYXQiLCJmaXJzdE5hbWUiOiIxIiwiaXNzIjoibGVhcm5lciIsImlhdCI6MTcwMjAxOTcyNywiZXhwIjoxNzAyNjI0NTI3LCJwcm92aWRlciI6Ik9zYXQiLCJwaWQiOjV9.kXvAqJGqR9jjDTobzlwQ4k_sLl0aFWvEIeST93elODA",
"Windows",
"Chrome"
]
},
"status": "TOO MANY SESSIONS"
}
In case if attribute name is dynamic you can always go for wildcard operator like
*
If you want to extract this guy:
The relevant JsonPath query would be something like:
Demo:
More information: How to Use the JSON Extractor For Testing