Path serves to locate specific parts or components within a JSON object. These paths start with the '$' symbol and follow JSONPath syntax. It is used to access particular elements or values within JSON objects passed in the Input Path, Output Path, and Result Path by describing their attributes. It's like using a navigation system to find your way to the intended destination (elements/values) within the JSON data.
This section details how to use JSON Paths to navigate and extract specific data from a JSON object. We'll illustrate these concepts using an example of an Employee Onboarding process that has the following JSON data as input:
{"employee_id": "E12345","name": "John Doe","department": "Engineering","onboarding": {"start_date": "2023-08-01","training_programs": ["Orientation","Technical Skills","Company Policies"],"completed": true}}
A value assigned to a property, say "propertyName" in a JSON object, can be accessed using the format $.property_name.
For example:
$.employee_id returns "E12345."
$.name returns "John Doe."
$.department returns "Engineering."
Similarly, to access any elements within an array at the specified index or index range, the conventions are,
$.array_name[index] - accesses an element within an array at the specified index.
$.array_name[start:end] - to access elements within an array index range (start to end). The slice notation [start:end] specifies that you want to include elements starting from the index start up to, but not including, the element at the index end.
$.array_name[start,count] - to access elements within an array, where "start" denotes the beginning index, and "count" specifies the number of elements you want to retrieve.
Example:
$.outer_property_name.inner_property_name - to access properties of a JSON object nested within another JSON object.
Example:
$.onboarding.start_date retrieves "2023-08-01."
$.onboarding.completed gives you the boolean value "true."
By using the following JSON path expression, data from the context object can be extracted. As you might know, context object is JSON data that has more information on the current execution and circuit state at run time. Refer to Context Object for more details.
This path expression is used to extract data from the process context rather than the input. Adding $$ to the beginning of a path specifies that you are looking for information within the context object.
Syntax:
$$.<JSON_Key> (replace 'JSON_Key' with the specific field name in the context object you want to retrieve).
Example:
If the previous state sets the following as its output:
{"execution_name": "test-case-1"}
You can access the full object from the key 'execution_name' using the JSON path expression $$['execution_name'] or $$.execution_name.
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.