I am learning the concept of different ways of storing credentials in UiPath and came across this topic. Please find the link below.
Please can anyone explain how to use and store credentials using a JSON file and extract the details in UiPath?
Any insights or help is really appreciated.
Thanks and Regards
Generally json structure is like this
We can access the data by first deserializing this string using deserialize json activity and say the output is in variable jobj which is a jobject type variable
Jobj("Creds")("username").ToString for username and replace it with password to retrieve the password
Hope this helps
Thank you @Anil_G for your response, really appriciate it. I tried doing what you suggested, but the output of Deserialze JSON im getting datatype as “Object” not jobject. Could you please guide me as to where am I going wrong.
Please find the attached code.
File based credential store JSON file.zip (2.6 KB)
In the deserialize json activity properties…you will see a type argument …which is to be changed to jobject…i guess jow it is object
Thank you so much @Anil_G for your time and help, the code you suggested worked amazingly well , but a just have 1 question, what if I have an array of credentials, please find the attached notepad file/ Image for reference
Credentials - Copy.json (242 Bytes)
So using the name I want to fetch the particular credentials.
Could you please tell me how to fetch credentials from an Array of credentials using the name?
Jobj("Credentials")(0)("name").ToString will give the first one
Like that change 0 to 1 etc to get each
You can as well use another deserialize on
jobj("Credentials").ToString and type argument as Jarray and then use for loop to get each credential in the loop
Thank you so much @Anil_G. Both the solutions you suggested worked pretty well. This concept is new to me so thank you for helping me out Hope you have a wonderful day.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.