Skip to content

Json Variable Extractor

JSON Extractors lets you extract values from HTTP JSON response bodies, using JSON path expressions.

Extracting variables from HTTP response helps you make your Virtual User have a dynamic behavior. Extracted variables can be injected in Logic Actions or HTTP Request Actions.

JSON Extractor

Field Description
Name Name of the variable created by this processor. Can be used with the ${...} syntax like any other variable.
From Extract from Response Headers or Response body.
Path The JSON Path to be used. We recommend creating it with the configure button. The path can be a variable but cannot contain text and a variable.
Default value If no value is found, the variable will be equal to this. With match number All, you get the default value if you do not provide an index number.
Match number Lets you choose how to deal with the regex having several results (or occurrences). Selecting All will change the behavior of your regex processor, see the dedicated section for more details.
Concatenate Results In case Match Number All is selected, this concatenate all matching values in a comma-separated list. The result is stored in a dedicated variable with the suffix _ALL.


The response selector, on the right, lets you choose which HTTP response is used for configuring and checking the JSON Path Action. So if neither recorded responses nor Validate VU responses are available, you have to configure the JSON Path Action manually.


The configure button or the configure icon opens a new window in which you can use our JSON Path creator:



You can search for Strings or JSON Path Expressions inside the response body using the search fields in the table headers.



Opening the debug panel allows you to quickly see the result of your JSON path. Make sure to check it every time you make a significant change:


Multiple occurrences

When the match number is set to all, the behavior of your JSON processor changes.

Instead of a single variable, a lot of variables are created:


Even if there is only one occurrence, the general structure of multiple occurrences extractions will always be:

  • WorkspaceName_N : the Nth value extracted,
  • WorkspaceName_ALL : all occurrences concatenated in a comma separated list,
  • WorkspaceName_matchNr : the number of values extracted, e.g. 4.

This means that you will have to provide an index when using this variable, typically the Foreach action or some functions are a good way to deal with this in a dynamic context.


Due to the way JSON Path is processed inside the underlying JMeter, Nodes of the same level may be extracted in a different order than what is displayed in OctoPerf. This shouldn't be an issue since the structure will be the same anyway.


It is possible to use a variable in the JSON Path but only to replace the entire expression otherwise the variable syntax may conflict with the JSON Path syntax.



For instance in a situation like this you might want to get all the workspace names in the list:

        "id": "629WW7T4pwtaiecauWi4PasdaQruHr",
        "name": "Templates",
        "userId": "user-42"
        "id": "QMSQSdFVkcQ4q4ktTVqeYXS7nVvEy9",
        "name": "Shared Providers",
        "userId": "user-42"
        "id": "K62vyCX2cymazgFH2bfkju6eNKUTYR",
        "name": "Demo",
        "userId": "user-42"
        "id": "XQ4PVBN3w7tmzf9r2Az8KsDeK4q3EZ",
        "name": "This is a test",
        "userId": "user-42"

To that end we can use one of the following JSON Path:

  • $[*]['name']
  • $