Skip to main content
Question

Type conversion from Any to string

  • August 13, 2024
  • 2 replies
  • 177 views

Forum|alt.badge.img+1

Hi Everyone,

I have a json as below.

{

  "one": "1”,

  "Two": 234567789,

  "Three": null

}

I am using Json package and converting this to dictionary and looping through the keys of this dictionary.

Assigned key to a variable strKey of type string

used get action from dictionary package and stored the value in a variable strValue of type any.

 

Now while i am running the bot i am getting the error as 'value' expecting 'String' received 'Double'. in the Dictionary Get assign action

 

My requirement is to read the json and create a table dynamically. i dont know the datatype of json values, i just need to convert them to string 

2 replies

Raul Jaimes
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • 494 replies
  • August 13, 2024

@Kiran A 

Try

 

{

    "one": [

        "1"

    ],

    "Two": [

        "234567789"

    ],

    "Three": null

}

 

https://jsonlint.com/

 

HTH

Regards


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • 1 reply
  • August 14, 2024

Hi @Raul Jaimes , 

I don't have control over the json, it is coming from an API response. I just gave a sample json on the request.

I dont know what datatypes i get from the api response, i just want to convert them to string.

i come from UiPath background and a simple .ToString would do that in UiPath, not sure how to achieve the same thing in Automation Anywhere

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings