enter image description hereI want to extract id value from json body whose partner join value is Yes
Response body sample:
{"data":{"data1":"{"recommendedPrograms":{"recommendedProgram":[{"id":"xxxxxxxx","programName":"ProgNme1","programNameLocal":"Prog Test","programDescription":"ProgDesc1","programDescriptionLocal":"Prog level1","partnerJoin":"No","priority":1,"version":"v5"},{"id":"yyyyyyy","programName":"ProgNme2","programNameLocal":"Prog Test2","programDescription":"ProgDesc2","programDescriptionLocal":"Prog level2","partnerJoin":"Yes","priority":1,"version":"v6"},{"id":"zzzzzzzzzz","programName":"ProgNme3","programNameLocal":"Prog Test3","programDescription":"ProgDesc3","programDescriptionLocal":"Prog level3","partnerJoin":"No","priority":1,"version":"v7"}]}"}}
Issue: Since jsonbody is in string format so not able to extract id value directly using json extractor.
Any lead on this will be highly appreciated.
Can anyone help me with beanshell or groovy script to handle id extraction.
Please refer image screenshot for response body sample as back slash is getting removed in the description .
What you posted as the text version is not a valid JSON, you won't be able to use either JSON Extractor or Groovy for working with it, you will need to go for i.e. Regular Expression Extractor
I will give you a hint: if you have JSON which is inlined into JSON object you could
Extract
data1attribute value into a JMeter Variable using JSON ExtractorThen you could use another JSON Extractor to extract what you need from
data1JMeter Variable