How to serialize JSON file

I’m trying to pass a datatable into an Orchestrator queue. I’ve seen several posts that talk about using newtonsoft.json package to serialize but I can’t find that in the packages list. Can someone advise on where to find the package, a different package that would work or how else I can pass a datatable to a queue?

3 Likes

@Will_Tyler

For this, why you want to serialize JSON file. Read one by one datarow from DataTable and then use Add Queue Item activity and specify QueueName and ItemInformation fields etc…

1 Like

@Will_Tyler Install UiPath.WebAPI.Activities

1 Like

@Will_Tyler

stringVariable = Newtonsoft.Json.JsonConvert.SerializeObject(Datatable)

you can pass this string to the AddQueueItem as a string.

Import Newtonsoft.json namespace

12 Likes

As I stated in my question, I’ve seen several posts that talk about using newtonsoft.json package to serialize but I can’t find that in the packages list to import. When I try to use the serialize command I get

Source: Add Queue Item

Message: Could not determine JSON object type for type System.Data.DataTable.

Exception Type: System.ArgumentException

I don’t have a package called UiPath.WebAPI.Activities. I have UiPath.Web.Activities installed but under my JSON list I only have deserialize.

The number of rows will change per transaction. I don’t want to fill up my TI with a large amount of blank fields.

Hi @Will_Tyler,

Please take a look at Bulk Add Queue Items. I think it will fit what you’re looking for.

1 Like

My Orchestrator version doesn’t support this but I don’t think it’s what I’m looking for either. From what I can tell, if I had 5 rows in my datatable this would create 5 different transactions. I want all 5 rows in 1 transaction.

how to get the newtensoft.json namespace

1 Like

from imports panel. you can find import panel just beside variables and arguments panel tabs.

Just do that: