How to read array from .json file?



“description”: “ReadJSON”,
“version”: “2016.2.6232.26817”,
“main”: “Main.xaml”,
“id”: “Main”,
“dependencies”: {},
“configurationOptions”: {},
“excludedData”: [
“page”:[ “1”, “2”, “3”,“4”,“5” ]

How I can read page into UiPath and find whether 5 is available in array. Thanks.


Well I’m not an expert with .json files. But if you use Read Text File to store it into a string, then you can use Split functions.

For example,
text.Split({""“page”":"},StringSplitOptions.None)(1).Split(Environment.NewLine(0))(0) will give you [ “1”, “2”, “3”, “4”, “5” ]

Then I guess you can replace the [, ], and " with Replace function. And if you want it to be stored into an array, then split by the comma.

For example,
text.Split({""“page”":"},StringSplitOptions.None)(1).Split(Environment.NewLine(0))(0).Replace("[","").Replace("]","").Replace("""","").Replace(" “,”").Split(","(0))

Not sure if that’s what you need but hope it helps.



Another soluction would be to use Deserialize Json activity

jObject(“page”).ToString will fetch you [ “1”, “2”, “3”,“4”,“5” ]


Thanks. Is it not possible to get the data as array and checking whether 5 is available or not using exists collection or contains method ?


Once you get "[ “1”, “2”, “3”, “4”, “5” ] stored in a string you can use .Contains

For example,
will return True or False

you can also use .Split function to create an array.
For example,
string.Replace(" “,”").Replace("[","").Replace("]","").Split(","(0))
will return an Array[of type string], and you can use a For Each with that



also in your case

String.Concat(jObject(“page”).ToString.Where(AddressOf Char.IsDigit)).ToArray

based on answer given by @ClaytonM in the past.


This might help: