Load Array of Strings from Config File

Hello all!

I was wondering if it was possible assign to a variable type of Array of Strings a value from the REFramework Config file.

I tried saving the value in the config in the following format: {"123,“456”}.
And I had a message saying that I cannot assign to an Array a String Value.



Any solution to this?

Thank you all in advance!

Yeah, you can use Json format in the string, then convert it to an array.
Json format would be like = [ 110, 220 ] or [ “abc”, “abc” ]

I think this will work cause it’s something I am using:

Loops through the settings, then parses column 2 to either an array of string or array of number.
It returns an array of Object though, so you’ll need to convert it to string or number as you use it.

If it fails to parse then it takes the setting in like normal in the catch side.



I have 1 or 2 arrays to call in a config file in a sheet called Array. Is there a way to call and assign these arrays from the object?

For example:
Column A: Column B:
Array1 {“Dan”, “Bob”, “Steve”, “Karen” }

I want to pull this Array1 from the config sheet “Array” and use this Array of String in a options property in an Input Dialogue activity. How do I do this?

To your screenshot:
Is JArray a variable? What type if it is?

Good question. You need to either import the Class or use the Class infront of it
Import Newtonsoft.Json.Linq
or use Newtonsoft.Json.Linq.JArray

Both should work.

Json Array is in format [ a,b,c ], with strings or numbers, but using this method to convert your array will store it to a Linq array and not an object array. This means you need to convert it at some point with CType(variable, Object())

If I remember right, I had a hard time converting it as I assigned it to the Dictionary, so I convert it when I use the dictionary in arguments or assign it to another variable in the main workflow.


I might revisit this at some point if it makes it easier for future development.

1 Like

If you have specific non-basic types stored as json strings, there’s an easier way:

// requires Newtonsoft.Json namespace
T yourVariable = JsonConvert.DeserializeObject(Of T)(jsonString)

Where T is any serializable type and jsonString is it’s json representation, f.e.:

If one is not too familiar with json, for making complex structures you can also make a workflow that creates your object and writes the json for you.

That way you don’t need to start from scratch for complex structures but can add 2-3 variables so that a “template” representation is created and then fill out the rest.

Sample flow:
JsonRoundTripSerializationWIthSaveToFile.xaml (5.9 KB)

Just deserialization part:


I have an array Array1 {“Dan”, “Bob”, “Steve”, “Karen” }, i want to read this from a config file.

how do we go about this?

In your config file:
Change the values from {“110”,“220”} to just 110,220
In your xaml file:
Array1 is a variable of type String
Assign: Array1 = Config(“Array1”).Split(Convert.ToChar(“,”))
That is it!!


Thanks bro, its working…:slight_smile: