enter image description here I want to extract id value from json body whosepartner 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 .
1条答案
按热度按时间ljsrvy3e1#
1.你是posting code as image,我想没有人愿意浪费时间把它转回来
1.您发布的文本版本不是有效的JSON,您将无法使用JSON Extractor或Groovy来处理它,您需要使用正则表达式Extractor
1.这不是一个代码编写服务,你应该首先尝试一些东西,然后分享重现你的问题的方法,并要求用代码解决问题,而不是为你做你的工作
我给予你一个提示:如果您有内嵌到JSON对象中JSON,您可以
1.使用JSON Extractor将
data1
属性值提取到JMeter Variable中1.然后,您可以使用另一个JSON提取器从
data1
JMeter变量中提取所需内容