Skip to main content

We are deploying a bot via API and the dev team wants to pass in a nested dictionary, a list of dictionaries, so to speak.  Is this possible?  If not, can json be passed in a string variable and then the json action package parse out what we need?

Hi @Renee 2678 ,

 

For handling the dictionary data’s

https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/commands/cloud-dictionary-command.html

Would you like to manipulate the JSON to get the data node/key, please explore the JSON object manager.

QuickTip: Using the JSON Object Manager Package

 

Thanks!


Thank you.  I don’t think a dictionary will work in this instance because they want to send a nested dictionary.  In other words multiple values for each key.  See below example payload they want to send.

  "doc_requirements": {
      "type": "LIST",
      "list":
        {
          "type": "DICTIONARY",
          "dictionary":
            {
              "key": "loan_number",
              "value": { "type": "STRING", "string": "236221127878" }
            },
            {
              "key": "stack",
              "value": { "type": "STRING", "string": "236221127878_Marsh.pdf" }
            },
            {
              "key": "individual_docs",
              "value": {
                "type": "STRING",
                "string": "236221127878_Marsh.pdf::Title - CPL,236221127878_Marsh.pdf::Final Underwriting Docs,236221127878_Marsh.pdf::Title - Wiring Instructions"
              }
            }
          ]
        },
        {
          "type": "DICTIONARY",
          "dictionary":
            {
              "key": "loan_number",
              "value": { "type": "STRING", "string": "109221025493" }
            },
            {
              "key": "stack",
              "value": {
                "type": "STRING",
                "string": "109221025493_Werling.pdf"
              }
            },
            {
              "key": "individual_docs",
              "value": {
                "type": "STRING",
                "string": "109221025493_Werling.pdf::Title - CPL,109221025493_Werling.pdf::Title - Wiring Instructions,109221025493_Werling.pdf::Final Underwriting Docs"
              }
            }
          ]


Hi @Renee 2678 ,

 

I don’t think there is a straight approach to fulfill this other than using some inline scripts like Python or Java or through some custom DLL.


Hi @Renee 2678 

You are right, we cannot achieve this directly. I’d recommend creating a custom DLL which will do the heavy lifting of calling this api and get you the output in desired format.

Interesting use case, could you also place a enhancement request with AA so it will be beneficial for everyone.


Dear @Renee 2678,

 

Yes, it is possible to pass a nested dictionary (a list of dictionaries) as an argument when deploying a bot via the API in Automation Anywhere. You can do this by converting the nested dictionary to a JSON string and passing the string as an argument to the API.

To convert the nested dictionary to a JSON string, you can use the "Convert to JSON" action from the "JSON" package in Automation Anywhere. This action takes a dictionary or list as an input and returns a JSON string representation of the data.

Here is an example of how you might use the "Convert to JSON" action to pass a nested dictionary as an argument to the API:

  1. Use the "Convert to JSON" action to convert the nested dictionary to a JSON string and store the result in a variable.

  2. Use the "Call API" action to call the API and pass the JSON string as an argument.

  3. Use the "Parse JSON" action from the "JSON" package to parse the JSON string and extract the data you need.

Alternatively, you could pass the nested dictionary directly as an argument to the API and use the "Parse JSON" action to parse the data on the server side. This would allow you to avoid the need to convert the data to a JSON string before calling the API.

 

Regards,


Dear @Renee 2678,

 

Yes, it is possible to pass a nested dictionary (a list of dictionaries) as an argument when deploying a bot via the API in Automation Anywhere. You can do this by converting the nested dictionary to a JSON string and passing the string as an argument to the API.

To convert the nested dictionary to a JSON string, you can use the "Convert to JSON" action from the "JSON" package in Automation Anywhere. This action takes a dictionary or list as an input and returns a JSON string representation of the data.

Here is an example of how you might use the "Convert to JSON" action to pass a nested dictionary as an argument to the API:

  1. Use the "Convert to JSON" action to convert the nested dictionary to a JSON string and store the result in a variable.

  2. Use the "Call API" action to call the API and pass the JSON string as an argument.

  3. Use the "Parse JSON" action from the "JSON" package to parse the JSON string and extract the data you need.

Alternatively, you could pass the nested dictionary directly as an argument to the API and use the "Parse JSON" action to parse the data on the server side. This would allow you to avoid the need to convert the data to a JSON string before calling the API.

 

Regards,

 

Hi @Zaibi ,

 

Where is this “Convert to JSON” action under the JSON package?? Are you using some other A360?


 


Thanks for all of the feedback.  I ended up going with the solution to have the Dev team send the data in  json to a string variable and then using the json action package and some assistance from this AAIllustrates video to get it into a useable format.  The only potential downside to this is the 65k character limit in a string variable.


I wonder how come something irrelevant to A360 selected as the best answer here.


Reply