Share this page

# web.regSaveParamJson

Example | Correlation Functions for JavaScript

Registers a request to save dynamic data in an buffer that has been formatted as Json. The data is saved to a parameter.

## Syntax

web.regSaveParamJson( {object} );

## JavaScript Object

    {
        paramName: "<string>",
        queryString: "<string>",
        selectAll: "<string>",
        DFEs: "<string>",
        notFound: "<string>",
        contentType: "<string>",
        headerNames: "<string>",
        ignoreRedirections: "<string>",
        relFrameID: "<string>",
        requestURL: "<string>",
        scope: "<string>"
    }

Property Name | Description
--- | ---
paramName | The name of the parameter to store the returned value. If the parameter does not exist, it is created.
queryString | The path of the value to save. For the syntax of the query string, see the Json path documentation on GitHub.
selectAll | Optional: If `selectAll=Yes`, all the occurrences of the match are saved in an array. See Saving Multiple Matches below.
DFEs | Optional. Comma separated list of Data Formats extensions that are to be used before the required search operation is to be performed.
notFound | Optional. The handling option when the search item is not found and an empty string is generated. One of: `"error"` - (default) Causes an error to be raised when a search item is not found. `"warning"` - Does not issue an error. If the search item is not found, it sets the parameter count to 0, and continues executing the script. The `"warning"` option is ideal if you want to see if a string was found, but you do not want the script to fail. Note: If Continue on Error is enabled for the script, then even when notFound is set to `"error"`, the script continues when the search item is not found, but an error message is written to the Extended log file.
contentType | For example, "text/html". Only responses with the specified contentType header are searched. The contentType can contain the * wildcard.
headerNames | A comma-separated list of HTTP response header names. Only the specified headers' values are searched. This argument applies only when the scope is "Headers"
ignoreRedirections | If ignoreRedirections is "Yes" and the server response is redirection information (HTTP status code 300-303, 307), the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and the search is performed on the response from that location. The default is "No".
relFrameID | The hierarchy level of the HTML page relative to the requested url. The possible values are ALL or a number. Click relframeid Attribute for a detailed description.
requestURL | Only responses to this request are searched. The URL can contain the * wildcard.
scope | Optional. Where to search for the delimited data. One of: All - Search the entire buffer (Default) Headers - Search only the headers body - Search only body data Cookies - Search only in cookies

## Return Values

Not applicable

## Parameterization

The values of keyword-value pairs can be parameterized. For example, "alt={altParam}".

## General Information

web.regSaveParamJson registers a request to find a Json node within the server response to the next Action Functions and save the string. This function is used when the server response is Json or converted to Json. For example, the function is used in conjunction with Data Format extensions that output in Json format. The search does not to apply values returned as a result of calls to asynchronous or cross-step functions.

This function registers a request to retrieve dynamic information from the Json and save the information to a parameter. For correlation, enclose the parameter name in braces (e.g., "{param1}") in ensuing function calls which use the dynamic data. The request registered by web.regSaveParam_json looks for the the node specified with the queryString argument and saves the contents of the node, if found. See also Correlating Statements.

Saving Multiple Matches

The web.regSaveParamJson function supports array type parameters. When you specify `selectAll=Yes`, all the occurrences of the match are saved in an array. Each element of the array is represented by the paramName_index. In the following example, the parameter name is A:

    web.regSaveParamJson( { paramName: "A", queryString: "$..arguments.additional_context[0].name", selectAll: "Yes" });

The first match is saved as A_1, the second match is saved as A_2, and so forth. You can retrieve the total number of matches by using the following term: paramName_count. For example, to retrieve the total number of matches saved to the parameter array, use:

`TotalNumberOfMatches=atoi(lr.evalString("{A_count}"));`

web.regSaveParamJson is not recorded. You can add it manually to a script.

## Restrictions

scope = `ALL does not apply to` web.regSaveParam_json.

No searches are performed in data downloaded asynchronously.

If the headernames filter argument is specified but the scope is not `Headers`, the headernames argument is ignored.

For more information on the DFEs argument, see Attributes for Save Parameter Registration Functions.

For more information on the headernames and scope arguments, see Search Filters for Save Parameter Registration Functions

For more information on the relframeid and selectAll arguments, see Search Filters for Save Parameter Registration Functions and relframeid Attribute.

See Also

## Example

    web.regSaveParamJson({
         paramName:"nameParam",
         queryString:"$..arguments.additional_context[0].name",
         scope:"Body"});

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: