JSON Paths in Circuit: A Comprehensive Guide | Circuit Online Help

JSON Path

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.

Using JSONPaths - A Quick Guide: 

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
  }
}

1. Accessing Object Properties  

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."

2. Accessing Array Elements  

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:

    • $.onboarding.training_programs returns the array ["Orientation", "Technical Skills", "Company Policies"].
    • $.onboarding.training_programs[0:2] returns ["Orientation", "Technical Skills"]. In this case, start is 0, and end is 2, which means you want to include elements at index 0 and 1, but not the element at index 2.
    • $.onboarding.training_programs[1,2] returns ["Technical Skills", "Company Policies"], located at index 1 and index 2. 

3. Accessing Nested Properties  

  • $.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."

For advanced JSON path usage and more filtering capabilities, refer here.

4. Access data from process Context: $$. (Process Context) 

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.






    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          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.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION









                                            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.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Output Path

                                                                                                                Output Path enables you to select a portion of the state's output and transfer it to the next state for processing, eliminating any unecessary objects from the JSON output. If the Output Path isn't specified, the entire JSON node (determined by the ...
                                                                                                              • Input Path

                                                                                                                Input Path enables you to filter and control the actual input passed to the state. By defining an Input Path (either in Builder View or Code View), using JSONPath notation, you can select a portion of the JSON input and use it for processing within ...
                                                                                                              • Result Selector and Result Path

                                                                                                                Result Path and Result Selector are employed to extract dynamic data from the state's result when the execution is successful. Result Selector Result selector lets you retrieve and process the runtime data, enabling flexible and dynamic data ...
                                                                                                              • Error selector and Error path

                                                                                                                Error Selector and Error Path are used to manage errors in a system. While Result Selector and Result Path control the output of a state upon successful execution, Error Selector and Error Path come into play when the are exceptional circumstances, ...
                                                                                                              • Advanced Fields

                                                                                                                Lookups Lookups are fields used to obtain a subset of options from available values in fields, tables, webhook API responses, or database query responses. Existing data available in the organization can be reused using lookups. Lookups usually return ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources