LoadRunner Practitioners Forum
cancel

Correlation of JSON response

Highlighted
VijayKidecha Contributor.
Contributor.

Correlation of JSON response

I am trying to correlate a dynamic response data in Vugen.  

 My JSON Response of a request is:

 "{"First":"123456 GHHGGHGG GGHGHGH","Second":"104706"}"

 

 

I want to capture

1. 23456 GHHGGHGG GGHGHGH

2. 104706

 

 

I have tried:

1. web_reg_save_param("Variable","LB=First\":\"","RB=\",",LAST);

did not work. output says,boundries not matched. total response size is 68 byte. and i have set max html param length to 99999.

2. web_reg_save_param_regexp(
        "ParamName=Varaible",
        "RegExp=\"{\"First\":\"(.*?)\",",
        "Ordinal=1",
        SEARCH_FILTERS,
        "Scope=Body",
        "RequestUrl=funCommonSearchData",
        LAST);

did not work.Output says boundries not matched. total response size is 68 byte. and i have set max html param length to 99999

 

The below is :

web_reg_save_param_json(
        "ParamName=CorrelationParameter",
        "QueryString=$.[0].*",
        SEARCH_FILTERS,
        "Scope=Body",
       LAST);

is working but it is capturing the whole response. 

 

Suggest me asap.

2 REPLIES
 Honored Contributor... Moshka  Honored Contributor...
 Honored Contributor...

Re: Correlation of JSON response

hi,

 

when i try both boundery and regexp on my env (using an echo service) the parameter extracted with no issues.

what verison are you using?

did you tried to compare the recorded and the replay snapshots?

did you try to use JavaScript instead of C as scripting language?

Micro Focus Performance Core.
Functional Architect
your performance, our passion!
ManojThota1 Respected Contributor.
Respected Contributor.

Re: Correlation of JSON response

Hello Vijay,

Your are giving the echo value in Query string of web_reg_save_param function to capture the whole value, if you need to capture the specified string value 12345, GHGHGHGHGGH and 104706., please mention the json path in Query string.

Please follow the below steps.

Step 1: Take the whole response of your json and put in online json editor (http://jsoneditoronline.org/) and convert the response into json format.

Step 2: Download the google add on like "json path finder".

Step 3: Search the value like 12345 in json path finder and take the json path 

Step 4: Put the json path in Query sting of web_reg_save_param_json function

Step 5: Follow the step 3 and step 4 for remaining two dynamic values also, you can capture the those response easily.

Hope this works fine :)

Regards,

Manoj Thota