How to Convert Object to Array of String

My Config file has a list like this: {“ThingOne”, “ThingTwo”, “ThingThree”}. I need to use the list within my code, so when importing my arguments, I just said I wanted to assign in_dictConfig(“ListOfThings”) to my argument in_ImportantList. I am getting a message that “Option Strict On disallows implicit conversions from ‘Object’ to ‘1-dimensional array of String’.”

Can someone please tell me what to type in the “value” for my argument to convert the object to an array of strings?

Hi @Joe.Matuch

Try with this expression
in_dictConfig(“ListOfThings”)(Index)

Index - Based on the value you need

Regards
Gokul

Thanks, but I need all the values. I want to loop through this list, so I don’t want to import a single value; I want to import the entire list of 3 strings. Is there a way to do that?

in general we would access the config value with
yourConfigVar(yourKey).toString

it is just recommended to store the array/list data different:

The string Approach:
grafik

yourConfigVar(yourKey).toString.Split({","},StringSplitOptions.RemoveEmptyEntries)

The JSON Approach:
grafik

1 Like

Hi,

Can you try to use CType as the following?

img20211213-a1

Regards,

1 Like

This was successful. I tried to loop over arrStr after doing the first two assigns, and it worked. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.