0
votes

Hi Im trying to extract a token from aa login request using json extractor in Jmeter, i cant seem to get it to extract. The Json body is

{"accessToken":"","accountType":"REGISTERED_USER","token":"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiQTI1NktXIiwia2lkIjoidC12ajZ1cTBJZXNITUtDTS1KbW5HOU5CNjZGUmFOdFZPTlVhbHFSY1B3NCJ9.-qKQMDZgnj7bqOyGhRMaKOh7NfkbEHVU0hLnBokuFoaZMn-MIFD6lg.GvA0VuGPp4mojqRH1C1vOw.xVKmgYe4IugZRs7OGflq-LYopS9nRVcEzY3j7IIlfabtcksO4T5iFg4ru_osdgEAbi3LMeefEX0zb1jSspE1XKChbV_ErawmZ-j_ZSv-lcLqe_ckeN1LXbqvdrxGX-YltsZcvageFAFOJ91je_rPElWGf8sdsTWhgUsccxD2qyBTPtdzfFtkpi_fF_tX0LZtj7pt0zObUBzQOeg7EhZtGnCTWQLok8ds_qHGYnqVg02uozTZljU8eGbDKQi6ULtsrO3EfnKORkCfw-q3FDwrWHxte0sYXYhdEpYwxUrPQ6Kcn67j9rS0BAogYe46fa5TeC2TxfQYuQNFh-7SO-6wT2rq54XiCd5a8Gx0G9g5JWDV3_mQJGrg91xeQ1Jw0cEgZJuhB0W6KbYarhH6BaYOjw.l4ULZYdARfNhBPBkewf6Ug"}

Im currently using:

Names of created variables: token
Json Path expressions: accessToken": "(.*?)" 
Match No: 1

It doesn't seem to work though, is the json extractor the correct thing to use?

1

1 Answers

0
votes

You are using syntax suitable for the Regular Expression Extractor

JSON Path is a different beast, you need to amend your "JSON Path expressions" to $.token

Demo:

enter image description here

More information: API Testing With JMeter and the JSON Extractor