jmeter

How to extract value from serialized json response in Jmeter


I am getting a response in form of serialized json format for an api request as below

{"Data":"{\"orderId\":null,\"Tokens\":{\"Key\":\"abcdefgh123456\",\"Txnid\":\"test_5950\"}","success":true,"Test":"success"}

I want to extract Key value in Jmeter and I have to use into next request. Can someone help me on extracting the value?


Solution

  • If your JSON really looks exactly like you posted the most suitable Post-Processor would be Regular Expression Extractor

    The relevant regular expression would be something like:

    "Key"?\s*:?\s*"(\w+)"
    

    where:

    enter image description here

    More information: