Description:
This step is used to fetch the JSON Result value
Inputs
- varGlobalHoldingJson - Variable or Global that holds the JSON string values
- jsonPathExp - JSON Path Expression
- mapping - map multiple JSON Path expressions and returns
- varGlobalResult - Store result in Variable or global
Returns
- Match – Found JSON path value
- NoMatch – JSON path not found value
Usage:
Example:
Let’s build and execute the “jsonPathGetValueDef” example.
- Create a new definition called “JsonPathGetValueDef”
- Select the definition and click the “design” button
- Drag the “updateVariable” and “JsonPathGetValue” steps from the toolbox
- Connect the dots between the controls as shown above
- Click the “updateVariable” step to configure its “Settings” properties. Provide a name to the step. Select the “Advanced” tab. Select the “Yes” option for the “Has Expression” field. Click on the button below to update multiple variables. Click the Add Row (+) button to insert an empty row. Provide the variable name and value. Use the add row buttons to insert multiple variables and values.
- The JSON script used in this example is included below.
{"store":
{"book":
[{"category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95},
{"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99},
{"category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99},
{"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "isbn": "0-395-19395-8", "price": 22.99}], "bicycle": {"color": "red", "price": 19.95}},"expensive": 10
}
- Click the "JsonPathGetValue" step to configure its "Settings" properties. Give the step a name and provide the variable/global to hold the JSON result.
- Click on the "JsonPathGetValue" step to configure its "Advanced" properties. Provide JSON Path expression and the variable/global reference for the JSON result. Click the button to map multiple JSON path expressions with variable/global references. You may get JSON values using single or multiple path expressions but not both. Here $.Row[*].length path expression returns the total count of the records available in the SQL result set.
- You may refer to this website for more JSONPath expression syntax.
- The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.
- Save the process definition, create a new instance, and execute. Render the process instance. Click on the “JsonPathGetValue” process step to view its properties. The step should get JSON result value.
Definition Sample:
You may download the sample definition(s) from the link here and later import it (drag-drop) to your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.
NOTE: Please verify and complete the process steps for any missing configurations, such as file path references and database connections after import. Then, save the definition to confirm the changes.
Click here to download the sample file.