Get Asset Values

Hi Team,

I have below values stored in asset. How to extract specific values from below?
{“GoogleUrl”: “www.google.com”, “UserName”: “Test”, “Password”: “Test”, “FirstName”: “Mark”}

Hello @Honda

This looks like a Dictionary.

You can use the Get Asset activity to get the value of the asset.
Then use the Deserialize JSON activity to convert it into Dictionary type variable.

Regards
Soren

1 Like

Did you stored this as a Text in the asset?

If you stored everything in one asset - My recommendation is to store these into 3 assets for security reasons

GoogleUrl as Text Asset
UserName and Password as Credential Asset
First Name as text Asset

If you still want to store in one asset - let us know. I can share the string operations

Hey @Honda have you stored all the data in 1 Asset? if yes then this is absolutely wrong way .
for Cred in the Asset Section Set Asset type as cred- because it is case senstive data and after that if you want to retrieve the cred use Get Credential activity in the studio.
and for URL and Name you can create seprate Asset of type Text abd for this you can use get asset activity.

cheers

Yes correct let’s remove the user name and password from the asset.
Assume only below values are stored in single asset and i want to access only the Age.
{“GoogleUrl”: “www.google.com”, “FirstName”: “Test”, “LastName”: “Test”, “Age”: “30”}

Hi @Honda

You have to convert the asset values to the dictionary variable.
→ Create a variable with Dictionary<String, String> type.
→ Use the Get Asset activity to get the value from the Asset and store in a variable called Asset_Var.
→ Then use the assign activity to convert asset value to dictionary,

- Assign -> dict_var = AssetVar.toString.Replace("{", "").Replace("}", "").Replace("""", "").Split(",").Select(Function(x) x.Split(":")).ToDictionary(Function(x) x(0).Trim(), Function(x) x(1).Trim())

Hope it helps!!

str_data =“{“GoogleUrl”: “www.google.com”, “FirstName”: “Test”, “LastName”: “Test”, “Age”: “30”}”

Syntax:
str_data.Split(“:“c).Last.ToString.Replace(”}”,“”).Replace(" “,”").Remove(0,1).Remove(2)

@Honda

  1. Get asset and store the value into string variable str
  2. Now use deserialize json and pass str as input and get the jsonstring output
  3. now use jsonstring("Age").ToString which gives 30 as output

Hope this helps

cheers

Hi @Honda

You can extract these by doing deserialization.
Below is the screenshot for your reference