Inject js makes string instead array

Hi everyone!
I tried to search, but didn’t find the answer.

I added “Inject js” to my activitie and my js code makes array as output, but Ui changes it to string.
How I can get array?
Thank you in advance!


Sorry could you please explain that conversion part what is happening.

If possible with screenshots.


Hi @Akobir,

According to Inject JS Script activity documentation, it is only possible to return String.

But, you can try a workaround…

Instead of returning your array, try this:

return JSON.stringfy(yourArrayVariable)

Then, you just need to Deserialize it:

If you need more details, let me know.

Kindly mark this answer as solution if it helped you.

Hi, Gustavo! Thank you for your answer, it was very helpful!
Maybe you have any example of workaround?

1 Like

Thank you for your answer! I’ll try to use Gustavo’s workaround.

1 Like

Hi @Akobir,

I’ll build an example here and share with you as soon as possible.


Gustavo, thanks!
I found the example in uipath docs, but I can’t find deserialize activitie.
If it possible - can you help me with this, pls?

1 Like

Hi @Akobir,

Sure, I’ll help you… just give me some time to finish the example I am creating here.

@Akobir, check it out: (3.1 KB)

Note: You must install UiPath.WebAPI.Activities dependence

1 Like

Thank you very much!
And else one question - how I can get a value from deserialize array?
For example, I have array with 2 columns
Can I get “result2” to messagebox?

1 Like

Hello @Akobir,

You’re welcome :slight_smile:

Yes, it is totally possible.

You can use Split, considering that you have an array of String where each item is separeted by comma.

Check the updated solution if necessary (3.3 KB)

If you need extra help, let me know

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